aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-28 11:00:16 +0100
committerAleksey Kladov <[email protected]>2018-07-28 11:00:16 +0100
commit52dc0ddc84544a59d3a2580d9944d0482a633349 (patch)
tree750ddab30c33eb46ae2ad6af9530cdf75e2d9c7d
parent9500ad521121f501aea02f549223eb583cb298ee (diff)
Add vis test
-rw-r--r--src/parser/grammar/mod.rs5
-rw-r--r--tests/data/parser/inline/0037_crate_visibility.rs4
-rw-r--r--tests/data/parser/inline/0037_crate_visibility.txt53
3 files changed, 62 insertions, 0 deletions
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs
index 54a63a547..23216452f 100644
--- a/src/parser/grammar/mod.rs
+++ b/src/parser/grammar/mod.rs
@@ -47,6 +47,11 @@ fn visibility(p: &mut Parser) {
47 p.bump(); 47 p.bump();
48 if p.at(L_PAREN) { 48 if p.at(L_PAREN) {
49 match p.nth(1) { 49 match p.nth(1) {
50 // test crate_visibility
51 // pub(crate) struct S;
52 // pub(self) struct S;
53 // pub(self) struct S;
54 // pub(self) struct S;
50 CRATE_KW | SELF_KW | SUPER_KW => { 55 CRATE_KW | SELF_KW | SUPER_KW => {
51 p.bump(); 56 p.bump();
52 p.bump(); 57 p.bump();
diff --git a/tests/data/parser/inline/0037_crate_visibility.rs b/tests/data/parser/inline/0037_crate_visibility.rs
new file mode 100644
index 000000000..faeefde94
--- /dev/null
+++ b/tests/data/parser/inline/0037_crate_visibility.rs
@@ -0,0 +1,4 @@
1pub(crate) struct S;
2pub(self) struct S;
3pub(self) struct S;
4pub(self) struct S;
diff --git a/tests/data/parser/inline/0037_crate_visibility.txt b/tests/data/parser/inline/0037_crate_visibility.txt
new file mode 100644
index 000000000..5fb410b67
--- /dev/null
+++ b/tests/data/parser/inline/0037_crate_visibility.txt
@@ -0,0 +1,53 @@
1FILE@[0; 81)
2 STRUCT_ITEM@[0; 21)
3 VISIBILITY@[0; 11)
4 PUB_KW@[0; 3)
5 L_PAREN@[3; 4)
6 CRATE_KW@[4; 9)
7 R_PAREN@[9; 10)
8 WHITESPACE@[10; 11)
9 STRUCT_KW@[11; 17)
10 NAME@[17; 19)
11 WHITESPACE@[17; 18)
12 IDENT@[18; 19) "S"
13 SEMI@[19; 20)
14 WHITESPACE@[20; 21)
15 STRUCT_ITEM@[21; 41)
16 VISIBILITY@[21; 31)
17 PUB_KW@[21; 24)
18 L_PAREN@[24; 25)
19 SELF_KW@[25; 29)
20 R_PAREN@[29; 30)
21 WHITESPACE@[30; 31)
22 STRUCT_KW@[31; 37)
23 NAME@[37; 39)
24 WHITESPACE@[37; 38)
25 IDENT@[38; 39) "S"
26 SEMI@[39; 40)
27 WHITESPACE@[40; 41)
28 STRUCT_ITEM@[41; 61)
29 VISIBILITY@[41; 51)
30 PUB_KW@[41; 44)
31 L_PAREN@[44; 45)
32 SELF_KW@[45; 49)
33 R_PAREN@[49; 50)
34 WHITESPACE@[50; 51)
35 STRUCT_KW@[51; 57)
36 NAME@[57; 59)
37 WHITESPACE@[57; 58)
38 IDENT@[58; 59) "S"
39 SEMI@[59; 60)
40 WHITESPACE@[60; 61)
41 STRUCT_ITEM@[61; 81)
42 VISIBILITY@[61; 71)
43 PUB_KW@[61; 64)
44 L_PAREN@[64; 65)
45 SELF_KW@[65; 69)
46 R_PAREN@[69; 70)
47 WHITESPACE@[70; 71)
48 STRUCT_KW@[71; 77)
49 NAME@[77; 79)
50 WHITESPACE@[77; 78)
51 IDENT@[78; 79) "S"
52 SEMI@[79; 80)
53 WHITESPACE@[80; 81)