Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/tests.rs')
-rw-r--r--crates/mbe/src/tests.rs168
1 files changed, 84 insertions, 84 deletions
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs
index 4a73b6fa05..a5672e4e05 100644
--- a/crates/mbe/src/tests.rs
+++ b/crates/mbe/src/tests.rs
@@ -3,7 +3,7 @@
// FIXME: Move more of the nameres independent tests from
// crates\hir-def\src\macro_expansion_tests\mod.rs to this
use expect_test::expect;
-use span::{Edition, EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContextId};
+use span::{Edition, EditionedFileId, ErasedFileAstId, FileId, Span, SpanAnchor, SyntaxContext};
use stdx::format_to;
use tt::{TextRange, TextSize};
@@ -26,7 +26,7 @@ fn check_(
file_id: EditionedFileId::new(FileId::from_raw(0), def_edition),
ast_id: ErasedFileAstId::from_raw(0),
},
- SyntaxContextId::root(Edition::CURRENT),
+ SyntaxContext::root(Edition::CURRENT),
decl,
)
.unwrap();
@@ -42,7 +42,7 @@ fn check_(
let arg_tt = syntax_bridge::parse_to_token_tree(
call_edition,
call_anchor,
- SyntaxContextId::root(Edition::CURRENT),
+ SyntaxContext::root(Edition::CURRENT),
arg,
)
.unwrap();
@@ -52,7 +52,7 @@ fn check_(
Span {
range: TextRange::up_to(TextSize::of(arg)),
anchor: call_anchor,
- ctx: SyntaxContextId::root(Edition::CURRENT),
+ ctx: SyntaxContext::root(Edition::CURRENT),
},
def_edition,
);
@@ -109,8 +109,8 @@ fn unbalanced_brace() {
"#,
r#""#,
expect![[r#"
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ SUBTREE {} 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
{}"#]],
);
@@ -132,25 +132,25 @@ fn token_mapping_smoke_test() {
struct MyTraitMap2
"#,
expect![[r#"
- IDENT struct 0:[email protected]#2
- IDENT MyTraitMap2 1:[email protected]#2
- IDENT map 0:[email protected]#2
- PUNCH : [alone] 0:[email protected]#2
- PUNCH : [joint] 0:[email protected]#2
- PUNCH : [alone] 0:[email protected]#2
- IDENT std 0:[email protected]#2
- PUNCH : [joint] 0:[email protected]#2
- PUNCH : [alone] 0:[email protected]#2
- IDENT collections 0:[email protected]#2
- PUNCH : [joint] 0:[email protected]#2
- PUNCH : [alone] 0:[email protected]#2
- IDENT HashSet 0:[email protected]#2
- PUNCH < [alone] 0:[email protected]#2
- PUNCH > [joint] 0:[email protected]#2
- PUNCH , [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ IDENT struct 0:[email protected]#ROOT2024
+ IDENT MyTraitMap2 1:[email protected]#ROOT2024
+ SUBTREE {} 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ IDENT map 0:[email protected]#ROOT2024
+ PUNCH : [alone] 0:[email protected]#ROOT2024
+ PUNCH : [joint] 0:[email protected]#ROOT2024
+ PUNCH : [alone] 0:[email protected]#ROOT2024
+ IDENT std 0:[email protected]#ROOT2024
+ PUNCH : [joint] 0:[email protected]#ROOT2024
+ PUNCH : [alone] 0:[email protected]#ROOT2024
+ IDENT collections 0:[email protected]#ROOT2024
+ PUNCH : [joint] 0:[email protected]#ROOT2024
+ PUNCH : [alone] 0:[email protected]#ROOT2024
+ IDENT HashSet 0:[email protected]#ROOT2024
+ PUNCH < [alone] 0:[email protected]#ROOT2024
+ SUBTREE () 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ PUNCH > [joint] 0:[email protected]#ROOT2024
+ PUNCH , [alone] 0:[email protected]#ROOT2024
struct MyTraitMap2 {
map: ::std::collections::HashSet<()>,
@@ -179,28 +179,28 @@ fn main() {
}
"#,
expect![[r#"
- IDENT fn 1:[email protected]#2
- IDENT main 1:[email protected]#2
- LITERAL Integer 1 1:[email protected]#2
- PUNCH ; [alone] 1:[email protected]#2
- LITERAL Float 1.0 1:[email protected]#2
- PUNCH ; [alone] 1:[email protected]#2
- LITERAL Integer 1 1:[email protected]#2
- PUNCH , [alone] 1:[email protected]#2
- PUNCH , [alone] 1:[email protected]#2
- PUNCH . [alone] 1:[email protected]#2
- LITERAL Float 0.0 1:[email protected]#2
- PUNCH ; [alone] 1:[email protected]#2
- IDENT let 1:[email protected]#2
- IDENT x 1:[email protected]#2
- PUNCH = [alone] 1:[email protected]#2
- LITERAL Integer 1 1:[email protected]#2
- PUNCH ; [alone] 1:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ IDENT fn 1:[email protected]#ROOT2024
+ IDENT main 1:[email protected]#ROOT2024
+ SUBTREE () 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ SUBTREE {} 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ LITERAL Integer 1 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 1:[email protected]#ROOT2024
+ LITERAL Float 1.0 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 1:[email protected]#ROOT2024
+ SUBTREE () 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ SUBTREE () 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ LITERAL Integer 1 1:[email protected]#ROOT2024
+ PUNCH , [alone] 1:[email protected]#ROOT2024
+ PUNCH , [alone] 1:[email protected]#ROOT2024
+ PUNCH . [alone] 1:[email protected]#ROOT2024
+ LITERAL Float 0.0 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 1:[email protected]#ROOT2024
+ IDENT let 1:[email protected]#ROOT2024
+ IDENT x 1:[email protected]#ROOT2024
+ PUNCH = [alone] 1:[email protected]#ROOT2024
+ LITERAL Integer 1 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 1:[email protected]#ROOT2024
fn main(){
1;
@@ -226,14 +226,14 @@ fn expr_2021() {
const { 1 },
"#,
expect![[r#"
- IDENT _ 1:[email protected]#2
- PUNCH ; [joint] 0:[email protected]#2
- IDENT const 1:[email protected]#2
- LITERAL Integer 1 1:[email protected]#2
- PUNCH ; [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ IDENT _ 1:[email protected]#ROOT2024
+ PUNCH ; [joint] 0:[email protected]#ROOT2024
+ SUBTREE () 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ IDENT const 1:[email protected]#ROOT2024
+ SUBTREE {} 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ LITERAL Integer 1 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 0:[email protected]#ROOT2024
_;
(const {
@@ -254,13 +254,13 @@ fn expr_2021() {
expect![[r#"
ExpandError {
inner: (
+ 1:[email protected]#ROOT2024,
NoMatchingRule,
),
}
- PUNCH ; [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 0:[email protected]#ROOT2024
;"#]],
);
@@ -278,13 +278,13 @@ fn expr_2021() {
expect![[r#"
ExpandError {
inner: (
+ 1:[email protected]#ROOT2024,
NoMatchingRule,
),
}
- PUNCH ; [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 0:[email protected]#ROOT2024
;"#]],
);
@@ -304,26 +304,26 @@ fn expr_2021() {
break 'foo bar,
"#,
expect![[r#"
- LITERAL Integer 4 1:[email protected]#2
- PUNCH ; [joint] 0:[email protected]#2
- LITERAL Str literal 1:[email protected]#2
- PUNCH ; [joint] 0:[email protected]#2
- IDENT funcall 1:[email protected]#2
- PUNCH ; [joint] 0:[email protected]#2
- IDENT future 1:[email protected]#2
- PUNCH . [alone] 1:[email protected]#2
- IDENT await 1:[email protected]#2
- PUNCH ; [joint] 0:[email protected]#2
- IDENT break 1:[email protected]#2
- PUNCH ' [joint] 1:[email protected]#2
- IDENT foo 1:[email protected]#2
- IDENT bar 1:[email protected]#2
- PUNCH ; [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ LITERAL Integer 4 1:[email protected]#ROOT2024
+ PUNCH ; [joint] 0:[email protected]#ROOT2024
+ LITERAL Str literal 1:[email protected]#ROOT2024
+ PUNCH ; [joint] 0:[email protected]#ROOT2024
+ SUBTREE () 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ IDENT funcall 1:[email protected]#ROOT2024
+ SUBTREE () 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ PUNCH ; [joint] 0:[email protected]#ROOT2024
+ SUBTREE () 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ IDENT future 1:[email protected]#ROOT2024
+ PUNCH . [alone] 1:[email protected]#ROOT2024
+ IDENT await 1:[email protected]#ROOT2024
+ PUNCH ; [joint] 0:[email protected]#ROOT2024
+ SUBTREE () 0:[email protected]#ROOT2024 0:[email protected]#ROOT2024
+ IDENT break 1:[email protected]#ROOT2024
+ PUNCH ' [joint] 1:[email protected]#ROOT2024
+ IDENT foo 1:[email protected]#ROOT2024
+ IDENT bar 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 0:[email protected]#ROOT2024
4;
"literal";
@@ -345,13 +345,13 @@ fn expr_2021() {
expect![[r#"
ExpandError {
inner: (
+ 1:[email protected]#ROOT2024,
NoMatchingRule,
),
}
- PUNCH ; [alone] 0:[email protected]#2
+ SUBTREE $$ 1:[email protected]#ROOT2024 1:[email protected]#ROOT2024
+ PUNCH ; [alone] 0:[email protected]#ROOT2024
;"#]],
);