summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_expand/src/tokenstream/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_expand/src/tokenstream/tests.rs')
-rw-r--r--compiler/rustc_expand/src/tokenstream/tests.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/rustc_expand/src/tokenstream/tests.rs b/compiler/rustc_expand/src/tokenstream/tests.rs
index eed696810..91c4dd732 100644
--- a/compiler/rustc_expand/src/tokenstream/tests.rs
+++ b/compiler/rustc_expand/src/tokenstream/tests.rs
@@ -1,7 +1,7 @@
use crate::tests::string_to_stream;
use rustc_ast::token;
-use rustc_ast::tokenstream::{TokenStream, TokenStreamBuilder};
+use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_span::create_default_session_globals_then;
use rustc_span::{BytePos, Span, Symbol};
@@ -19,10 +19,9 @@ fn test_concat() {
let test_res = string_to_ts("foo::bar::baz");
let test_fst = string_to_ts("foo::bar");
let test_snd = string_to_ts("::baz");
- let mut builder = TokenStreamBuilder::new();
- builder.push(test_fst);
- builder.push(test_snd);
- let eq_res = builder.build();
+ let mut eq_res = TokenStream::default();
+ eq_res.push_stream(test_fst);
+ eq_res.push_stream(test_snd);
assert_eq!(test_res.trees().count(), 5);
assert_eq!(eq_res.trees().count(), 5);
assert_eq!(test_res.eq_unspanned(&eq_res), true);
@@ -99,11 +98,10 @@ fn test_is_empty() {
#[test]
fn test_dotdotdot() {
create_default_session_globals_then(|| {
- let mut builder = TokenStreamBuilder::new();
- builder.push(TokenStream::token_joint(token::Dot, sp(0, 1)));
- builder.push(TokenStream::token_joint(token::Dot, sp(1, 2)));
- builder.push(TokenStream::token_alone(token::Dot, sp(2, 3)));
- let stream = builder.build();
+ let mut stream = TokenStream::default();
+ 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_eq!(stream.trees().count(), 1);
})