fix escape test

This commit is contained in:
Niko Matsakis 2015-07-19 14:20:59 -04:00
parent d5b2603bcb
commit 0ec6824eeb
2 changed files with 13 additions and 11 deletions

View File

@ -198,7 +198,7 @@ impl<'input> Tokenizer<'input> {
Some(idx1) => {
self.bump(); // consume the '`'
let text: &'input str = &self.text[idx0+1..idx1]; // do not include the `` in the str
Ok((idx0, Escape(text), idx1))
Ok((idx0, Escape(text), idx1+1))
}
None => {
Err(UnterminatedEscape(idx0))

View File

@ -66,16 +66,18 @@ fn code_forgot_comma() {
#[test]
fn various_kinds_of_ids() {
test("foo<T<'a,U>>", vec![
("~~~ ", MacroId("foo")),
(" ~ ", LessThan),
(" ~ ", MacroId("T")),
(" ~ ", LessThan),
(" ~~ ", Lifetime("'a")),
(" ~ ", Comma),
(" ~ ", Id("U")),
(" ~ ", GreaterThan),
(" ~", GreaterThan),
test("foo<T<'a,U,`Z*{}`>>", vec![
("~~~ ", MacroId("foo")),
(" ~ ", LessThan),
(" ~ ", MacroId("T")),
(" ~ ", LessThan),
(" ~~ ", Lifetime("'a")),
(" ~ ", Comma),
(" ~ ", Id("U")),
(" ~ ", Comma),
(" ~~~~~~ ", Escape("Z*{}")),
(" ~ ", GreaterThan),
(" ~", GreaterThan),
]);
}