Skip to content

Commit

Permalink
Add out-of-order call to source_text test
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 9, 2023
1 parent c4c3251 commit 6461c2d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,19 @@ fn literal_span() {
#[cfg(span_locations)]
#[test]
fn source_text() {
let input = " 𓀕 c ";
let input = " 𓀕 a z ";
let mut tokens = input
.parse::<proc_macro2::TokenStream>()
.unwrap()
.into_iter();

let ident = tokens.next().unwrap();
assert_eq!("𓀕", ident.span().source_text().unwrap());
let first = tokens.next().unwrap();
assert_eq!("𓀕", first.span().source_text().unwrap());

let ident = tokens.next().unwrap();
assert_eq!("c", ident.span().source_text().unwrap());
let second = tokens.next().unwrap();
let third = tokens.next().unwrap();
assert_eq!("z", third.span().source_text().unwrap());
assert_eq!("a", second.span().source_text().unwrap());
}

#[test]
Expand Down

0 comments on commit 6461c2d

Please sign in to comment.