Skip to content

Commit

Permalink
Add a test involving byte order mark
Browse files Browse the repository at this point in the history
Currently fails with:

    thread 'byte_order_mark' panicked at 'called `Result::unwrap()` on
    an `Err` value: LexError { span: Span }', tests/test.rs:637:48
  • Loading branch information
dtolnay committed Sep 29, 2022
1 parent f26128d commit eeb2e5b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,13 @@ fn check_spans_internal(ts: TokenStream, lines: &mut &[(usize, usize, usize, usi
}
}
}

#[test]
fn byte_order_mark() {
let string = "\u{feff}foo";
let tokens = string.parse::<TokenStream>().unwrap();
match tokens.into_iter().next().unwrap() {
TokenTree::Ident(ident) => assert_eq!(ident, "foo"),
_ => unreachable!(),
}
}

0 comments on commit eeb2e5b

Please sign in to comment.