diff options
| author | The rustc-dev-guide Cronjob Bot <github-actions@github.com> | 2025-06-09 04:09:17 +0000 |
|---|---|---|
| committer | The rustc-dev-guide Cronjob Bot <github-actions@github.com> | 2025-06-09 04:09:17 +0000 |
| commit | 7565e75591c2ef184bc7a359b3a436a62d45358a (patch) | |
| tree | 84784da83b710a97f9944b753c9d7717e37b631b /compiler/rustc_parse/src/parser/tokenstream | |
| parent | f598bbd66b8e0cf5ac1adf0ff6147baa7601a731 (diff) | |
| parent | c31cccb7b5cc098b1a8c1794ed38d7fdbec0ccb0 (diff) | |
| download | rust-7565e75591c2ef184bc7a359b3a436a62d45358a.tar.gz rust-7565e75591c2ef184bc7a359b3a436a62d45358a.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_parse/src/parser/tokenstream')
| -rw-r--r-- | compiler/rustc_parse/src/parser/tokenstream/tests.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/tokenstream/tests.rs b/compiler/rustc_parse/src/parser/tokenstream/tests.rs index aac75323ff3..19b2c98f5af 100644 --- a/compiler/rustc_parse/src/parser/tokenstream/tests.rs +++ b/compiler/rustc_parse/src/parser/tokenstream/tests.rs @@ -14,6 +14,10 @@ fn sp(a: u32, b: u32) -> Span { Span::with_root_ctxt(BytePos(a), BytePos(b)) } +fn cmp_token_stream(a: &TokenStream, b: &TokenStream) -> bool { + a.len() == b.len() && a.iter().zip(b.iter()).all(|(x, y)| x.eq_unspanned(y)) +} + #[test] fn test_concat() { create_default_session_globals_then(|| { @@ -25,7 +29,7 @@ fn test_concat() { eq_res.push_stream(test_snd); assert_eq!(test_res.iter().count(), 5); assert_eq!(eq_res.iter().count(), 5); - assert_eq!(test_res.eq_unspanned(&eq_res), true); + assert_eq!(cmp_token_stream(&test_res, &eq_res), true); }) } @@ -104,7 +108,7 @@ fn test_dotdotdot() { stream.push_tree(TokenTree::token_joint(token::Dot, sp(0, 1))); stream.push_tree(TokenTree::token_joint(token::Dot, sp(1, 2))); stream.push_tree(TokenTree::token_alone(token::Dot, sp(2, 3))); - assert!(stream.eq_unspanned(&string_to_ts("..."))); + assert!(cmp_token_stream(&stream, &string_to_ts("..."))); assert_eq!(stream.iter().count(), 1); }) } |
