aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/lexer/0001_hello.txt2
-rw-r--r--tests/lexer.rs16
2 files changed, 10 insertions, 8 deletions
diff --git a/tests/data/lexer/0001_hello.txt b/tests/data/lexer/0001_hello.txt
index 5bec9be80..e0b6a1f10 100644
--- a/tests/data/lexer/0001_hello.txt
+++ b/tests/data/lexer/0001_hello.txt
@@ -1,3 +1,3 @@
1IDENT 5 1IDENT 5
2WHITESPACE 1 2WHITESPACE 1
3IDENT 5 \ No newline at end of file 3IDENT 5
diff --git a/tests/lexer.rs b/tests/lexer.rs
index a27e7c395..a3c8916b1 100644
--- a/tests/lexer.rs
+++ b/tests/lexer.rs
@@ -41,13 +41,15 @@ fn lexer_test_case(path: &Path) {
41 dump_tokens(&tokens) 41 dump_tokens(&tokens)
42 }; 42 };
43 let expected = file::get_text(&path.with_extension("txt")).unwrap(); 43 let expected = file::get_text(&path.with_extension("txt")).unwrap();
44 44 let expected = expected.as_str();
45 assert_diff!( 45 let actual = actual.as_str();
46 expected.as_str(), 46 if expected == actual {
47 actual.as_str(), 47 return
48 "\n", 48 }
49 0 49 if expected.trim() == actual.trim() {
50 ) 50 panic!("Whitespace difference!")
51 }
52 assert_diff!(expected, actual, "\n", 0)
51} 53}
52 54
53fn tokenize(text: &str) -> Vec<Token> { 55fn tokenize(text: &str) -> Vec<Token> {