Add YAML formatting tests

This commit is contained in:
Lukas Kalbertodt
2022-10-19 10:11:43 +02:00
parent 736584ad9d
commit 4f5c458150
4 changed files with 76 additions and 1 deletions

View File

@@ -255,7 +255,6 @@ mod tests {
fn no_comments() {
let out = format::<test_utils::example1::Conf>(FormatOptions {
comments: false,
indent: 0,
.. FormatOptions::default()
});
assert_str_eq!(&out, include_format_output!("1-no-comments.toml"));

View File

@@ -229,3 +229,26 @@ impl fmt::Display for PrintExpr {
}
}
}
#[cfg(test)]
mod tests {
use crate::test_utils::{self, include_format_output};
use super::{format, FormatOptions};
use pretty_assertions::assert_str_eq;
#[test]
fn default() {
let out = format::<test_utils::example1::Conf>(FormatOptions::default());
assert_str_eq!(&out, include_format_output!("1-default.yaml"));
}
#[test]
fn no_comments() {
let out = format::<test_utils::example1::Conf>(FormatOptions {
comments: false,
.. FormatOptions::default()
});
assert_str_eq!(&out, include_format_output!("1-no-comments.yaml"));
}
}