Skip to content

Commit 7de4b96

Browse files
committed
add test for macro items
1 parent 25dd65d commit 7de4b96

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

crates/parser/src/tests/top_entries.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,43 @@ fn macro_stmt() {
9292
);
9393
}
9494

95+
#[test]
96+
fn macro_items() {
97+
check(
98+
TopEntryPoint::MacroItems,
99+
"#!/usr/bin/rust",
100+
expect![[r##"
101+
MACRO_ITEMS
102+
ERROR
103+
SHEBANG "#!/usr/bin/rust"
104+
error 0: expected an item
105+
"##]],
106+
);
107+
check(
108+
TopEntryPoint::MacroItems,
109+
"struct S; foo!{}",
110+
expect![[r#"
111+
MACRO_ITEMS
112+
STRUCT
113+
STRUCT_KW "struct"
114+
WHITESPACE " "
115+
NAME
116+
IDENT "S"
117+
SEMICOLON ";"
118+
WHITESPACE " "
119+
MACRO_CALL
120+
PATH
121+
PATH_SEGMENT
122+
NAME_REF
123+
IDENT "foo"
124+
BANG "!"
125+
TOKEN_TREE
126+
L_CURLY "{"
127+
R_CURLY "}"
128+
"#]],
129+
);
130+
}
131+
95132
#[track_caller]
96133
fn check(entry: TopEntryPoint, input: &str, expect: expect_test::Expect) {
97134
let (parsed, _errors) = super::parse(entry, input);

0 commit comments

Comments
 (0)