From c22e695764a8eb45605712fa3ef1ffe7a5beb1df Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 3 Nov 2018 18:24:27 +0100 Subject: map_group_shows_error_in_middle_of_line: Add unexpected token assertion In addition to asserting the position of the error, also check that it's the error we expect by looking for an unexpected 'n' token. --- src/parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/parser.rs b/src/parser.rs index 97fbcf0..2e4bf3e 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1548,13 +1548,17 @@ not-a-kind map "; let result = map_group().easy_parse(State::new(text)).map(|t| t.0); + let error = result.unwrap_err(); assert_eq!( - result.unwrap_err().position, + error.position, SourcePosition { line: 2, column: 6, } ); + assert!(error.errors.contains( + &easy::Error::Unexpected('n'.into()), + )); } } -- cgit v1.2.3