aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-03 18:24:27 +0100
committerTeddy Wing2018-11-03 18:24:27 +0100
commitc22e695764a8eb45605712fa3ef1ffe7a5beb1df (patch)
treee64c27d265c0e9acec6f85bc3a8148a80345337c
parente3e0b70d1c7195b460784a333e07019c6b3a19c9 (diff)
downloaddome-key-map-c22e695764a8eb45605712fa3ef1ffe7a5beb1df.tar.bz2
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.
-rw-r--r--src/parser.rs6
1 files changed, 5 insertions, 1 deletions
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 <play> <Nop>
map <not-a-button> <Nop>
";
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()),
+ ));
}
}