aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/src/lib.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/testutils/src/lib.rs b/tests/testutils/src/lib.rs
index b50e70849..ae1dea810 100644
--- a/tests/testutils/src/lib.rs
+++ b/tests/testutils/src/lib.rs
@@ -26,21 +26,20 @@ where
26 F: Fn(&str) -> String, 26 F: Fn(&str) -> String,
27{ 27{
28 for path in collect_tests(paths) { 28 for path in collect_tests(paths) {
29 let actual = { 29 let input_code = read_text(&path);
30 let text = read_text(&path); 30 let parse_tree = f(&input_code);
31 f(&text)
32 };
33 let path = path.with_extension("txt"); 31 let path = path.with_extension("txt");
34 if !path.exists() { 32 if !path.exists() {
35 println!("\nfile: {}", path.display()); 33 println!("\nfile: {}", path.display());
36 println!("No .txt file with expected result, creating..."); 34 println!("No .txt file with expected result, creating...\n");
37 file::put_text(&path, actual).unwrap(); 35 println!("{}\n{}", input_code, parse_tree);
36 file::put_text(&path, parse_tree).unwrap();
38 panic!("No expected result") 37 panic!("No expected result")
39 } 38 }
40 let expected = read_text(&path); 39 let expected = read_text(&path);
41 let expected = expected.as_str(); 40 let expected = expected.as_str();
42 let actual = actual.as_str(); 41 let parse_tree = parse_tree.as_str();
43 assert_equal_text(expected, actual, &path); 42 assert_equal_text(expected, parse_tree, &path);
44 } 43 }
45} 44}
46 45