aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-02-11 09:58:32 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-02-11 09:58:32 +0000
commit7176029803fe2e00f29ab7d20a384e3ee6f53ba3 (patch)
tree51e7251231162d5d31b6e18fabdbb466ffb94d19 /tests/testutils
parente19d038a0e1d9af8270450c5fe8fbbdf0f15cb24 (diff)
parent96437b050f2743fef2e37eaab7259f2f98f9b473 (diff)
Merge #48
48: Types r=matklad a=matklad bors r+
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