Flatten redundant test module run_make_support::diff::tests::tests

This commit is contained in:
Zalathar 2024-08-17 17:04:29 +10:00
parent 1bc403daad
commit 395b0787d4

View file

@ -1,24 +1,19 @@
#[cfg(test)]
mod tests {
use crate::*;
use crate::*;
#[test]
fn test_diff() {
#[test]
fn test_diff() {
let expected = "foo\nbar\nbaz\n";
let actual = "foo\nbar\nbaz\n";
diff().expected_text("EXPECTED_TEXT", expected).actual_text("ACTUAL_TEXT", actual).run();
}
}
#[test]
fn test_should_panic() {
#[test]
fn test_should_panic() {
let expected = "foo\nbar\nbaz\n";
let actual = "foo\nbaz\nbar\n";
let output = std::panic::catch_unwind(|| {
diff()
.expected_text("EXPECTED_TEXT", expected)
.actual_text("ACTUAL_TEXT", actual)
.run();
diff().expected_text("EXPECTED_TEXT", expected).actual_text("ACTUAL_TEXT", actual).run();
})
.unwrap_err();
@ -35,10 +30,10 @@ test failed: `EXPECTED_TEXT` is different from `ACTUAL_TEXT`
";
assert_eq!(output.downcast_ref::<String>().unwrap(), expected_output);
}
}
#[test]
fn test_normalize() {
#[test]
fn test_normalize() {
let expected = "
running 2 tests
..
@ -57,5 +52,4 @@ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
.actual_text("ACTUAL_TEXT", actual)
.normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME")
.run();
}
}