From 171baf4c4863f035384c6c63a5f0ce531b01cf9d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 29 Dec 2017 23:33:04 +0300 Subject: Simple identifier lexer --- tests/data/lexer/0001_hello.txt | 2 +- tests/lexer.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'tests') 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 @@ IDENT 5 WHITESPACE 1 -IDENT 5 \ No newline at end of file +IDENT 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) { dump_tokens(&tokens) }; let expected = file::get_text(&path.with_extension("txt")).unwrap(); - - assert_diff!( - expected.as_str(), - actual.as_str(), - "\n", - 0 - ) + let expected = expected.as_str(); + let actual = actual.as_str(); + if expected == actual { + return + } + if expected.trim() == actual.trim() { + panic!("Whitespace difference!") + } + assert_diff!(expected, actual, "\n", 0) } fn tokenize(text: &str) -> Vec { -- cgit v1.2.3