diff options
Diffstat (limited to 'vendor/proc-macro2/tests')
-rw-r--r-- | vendor/proc-macro2/tests/test.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/proc-macro2/tests/test.rs b/vendor/proc-macro2/tests/test.rs index 8e47b46f0..b75cd5527 100644 --- a/vendor/proc-macro2/tests/test.rs +++ b/vendor/proc-macro2/tests/test.rs @@ -325,6 +325,24 @@ fn literal_span() { assert!(positive.subspan(1..4).is_none()); } +#[cfg(span_locations)] +#[test] +fn source_text() { + let input = " 𓀕 a z "; + let mut tokens = input + .parse::<proc_macro2::TokenStream>() + .unwrap() + .into_iter(); + + let first = tokens.next().unwrap(); + assert_eq!("𓀕", first.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] fn roundtrip() { fn roundtrip(p: &str) { |