Skip to content

Commit 003ea63

Browse files
committed
Add more inline tests
1 parent b072e68 commit 003ea63

File tree

9 files changed

+54
-0
lines changed

9 files changed

+54
-0
lines changed

src/parser/event_parser/grammar/items/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,29 @@ fn item(p: &mut Parser) {
2525
use_item::use_item(p);
2626
USE_ITEM
2727
}
28+
// test extern_crate
29+
// extern crate foo;
2830
EXTERN_KW if la == CRATE_KW => {
2931
extern_crate_item(p);
3032
EXTERN_CRATE_ITEM
3133
}
3234
EXTERN_KW => {
3335
abi(p);
3436
match p.current() {
37+
// test extern_fn
38+
// extern fn foo() {}
3539
FN_KW => {
3640
fn_item(p);
3741
FN_ITEM
3842
}
43+
// test extern_block
44+
// extern {}
3945
L_CURLY => {
4046
extern_block(p);
4147
EXTERN_BLOCK
4248
}
49+
// test extern_struct
50+
// extern struct Foo;
4351
_ => {
4452
item.abandon(p);
4553
p.error().message("expected `fn` or `{`").emit();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FILE@[0; 10)
2+
EXTERN_BLOCK@[0; 10)
3+
ABI@[0; 7)
4+
EXTERN_KW@[0; 6)
5+
WHITESPACE@[6; 7)
6+
L_CURLY@[7; 8)
7+
R_CURLY@[8; 9)
8+
WHITESPACE@[9; 10)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern fn foo() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FILE@[0; 19)
2+
FN_ITEM@[0; 19)
3+
ABI@[0; 7)
4+
EXTERN_KW@[0; 6)
5+
WHITESPACE@[6; 7)
6+
FN_KW@[7; 9)
7+
WHITESPACE@[9; 10)
8+
IDENT@[10; 13) "foo"
9+
L_PAREN@[13; 14)
10+
R_PAREN@[14; 15)
11+
WHITESPACE@[15; 16)
12+
L_CURLY@[16; 17)
13+
R_CURLY@[17; 18)
14+
WHITESPACE@[18; 19)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern crate foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FILE@[0; 18)
2+
EXTERN_CRATE_ITEM@[0; 18)
3+
EXTERN_KW@[0; 6)
4+
WHITESPACE@[6; 7)
5+
CRATE_KW@[7; 12)
6+
WHITESPACE@[12; 13)
7+
IDENT@[13; 16) "foo"
8+
SEMI@[16; 17)
9+
WHITESPACE@[17; 18)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extern struct Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FILE@[0; 19)
2+
ABI@[0; 7)
3+
EXTERN_KW@[0; 6)
4+
WHITESPACE@[6; 7)
5+
err: `expected `fn` or `{``
6+
STRUCT_ITEM@[7; 19)
7+
STRUCT_KW@[7; 13)
8+
WHITESPACE@[13; 14)
9+
IDENT@[14; 17) "Foo"
10+
SEMI@[17; 18)
11+
WHITESPACE@[18; 19)

0 commit comments

Comments
 (0)