aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/lexer/0011_keywords.rs2
-rw-r--r--tests/data/lexer/0011_keywords.txt2
-rw-r--r--tests/data/parser/inline/0014_type_item_type_params.rs1
-rw-r--r--tests/data/parser/inline/0014_type_item_type_params.txt17
-rw-r--r--tests/data/parser/inline/0015_type_item.rs1
-rw-r--r--tests/data/parser/inline/0015_type_item.txt11
-rw-r--r--tests/data/parser/inline/0016_type_item_where_clause.rs1
-rw-r--r--tests/data/parser/inline/0016_type_item_where_clause.txt20
-rw-r--r--tests/testutils/src/lib.rs7
9 files changed, 57 insertions, 5 deletions
diff --git a/tests/data/lexer/0011_keywords.rs b/tests/data/lexer/0011_keywords.rs
index b74fc606e..7a9509f3c 100644
--- a/tests/data/lexer/0011_keywords.rs
+++ b/tests/data/lexer/0011_keywords.rs
@@ -1,3 +1,3 @@
1fn use struct trait enum impl true false as extern crate 1fn use struct trait enum impl true false as extern crate
2mod pub self super in where for loop while if match const 2mod pub self super in where for loop while if match const
3static mut 3static mut type
diff --git a/tests/data/lexer/0011_keywords.txt b/tests/data/lexer/0011_keywords.txt
index 05b1f0995..96528952b 100644
--- a/tests/data/lexer/0011_keywords.txt
+++ b/tests/data/lexer/0011_keywords.txt
@@ -47,4 +47,6 @@ WHITESPACE 1 "\n"
47STATIC_KW 6 "static" 47STATIC_KW 6 "static"
48WHITESPACE 1 " " 48WHITESPACE 1 " "
49MUT_KW 3 "mut" 49MUT_KW 3 "mut"
50WHITESPACE 1 " "
51TYPE_KW 4 "type"
50WHITESPACE 1 "\n" 52WHITESPACE 1 "\n"
diff --git a/tests/data/parser/inline/0014_type_item_type_params.rs b/tests/data/parser/inline/0014_type_item_type_params.rs
new file mode 100644
index 000000000..defd110c4
--- /dev/null
+++ b/tests/data/parser/inline/0014_type_item_type_params.rs
@@ -0,0 +1 @@
type Result<T> = ();
diff --git a/tests/data/parser/inline/0014_type_item_type_params.txt b/tests/data/parser/inline/0014_type_item_type_params.txt
new file mode 100644
index 000000000..b0f0f8337
--- /dev/null
+++ b/tests/data/parser/inline/0014_type_item_type_params.txt
@@ -0,0 +1,17 @@
1FILE@[0; 21)
2 TYPE_ITEM@[0; 21)
3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5)
5 IDENT@[5; 11) "Result"
6 TYPE_PARAM_LIST@[11; 15)
7 L_ANGLE@[11; 12)
8 TYPE_PARAM@[12; 13)
9 IDENT@[12; 13) "T"
10 R_ANGLE@[13; 14)
11 WHITESPACE@[14; 15)
12 EQ@[15; 16)
13 WHITESPACE@[16; 17)
14 L_PAREN@[17; 18)
15 R_PAREN@[18; 19)
16 SEMI@[19; 20)
17 WHITESPACE@[20; 21)
diff --git a/tests/data/parser/inline/0015_type_item.rs b/tests/data/parser/inline/0015_type_item.rs
new file mode 100644
index 000000000..04c0344fa
--- /dev/null
+++ b/tests/data/parser/inline/0015_type_item.rs
@@ -0,0 +1 @@
type Foo = Bar;
diff --git a/tests/data/parser/inline/0015_type_item.txt b/tests/data/parser/inline/0015_type_item.txt
new file mode 100644
index 000000000..382d7ece0
--- /dev/null
+++ b/tests/data/parser/inline/0015_type_item.txt
@@ -0,0 +1,11 @@
1FILE@[0; 16)
2 TYPE_ITEM@[0; 16)
3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5)
5 IDENT@[5; 8) "Foo"
6 WHITESPACE@[8; 9)
7 EQ@[9; 10)
8 WHITESPACE@[10; 11)
9 IDENT@[11; 14) "Bar"
10 SEMI@[14; 15)
11 WHITESPACE@[15; 16)
diff --git a/tests/data/parser/inline/0016_type_item_where_clause.rs b/tests/data/parser/inline/0016_type_item_where_clause.rs
new file mode 100644
index 000000000..a602d07f0
--- /dev/null
+++ b/tests/data/parser/inline/0016_type_item_where_clause.rs
@@ -0,0 +1 @@
type Foo where Foo: Copy = ();
diff --git a/tests/data/parser/inline/0016_type_item_where_clause.txt b/tests/data/parser/inline/0016_type_item_where_clause.txt
new file mode 100644
index 000000000..ddd335870
--- /dev/null
+++ b/tests/data/parser/inline/0016_type_item_where_clause.txt
@@ -0,0 +1,20 @@
1FILE@[0; 31)
2 TYPE_ITEM@[0; 31)
3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5)
5 IDENT@[5; 8) "Foo"
6 WHERE_CLAUSE@[8; 25)
7 WHITESPACE@[8; 9)
8 WHERE_KW@[9; 14)
9 WHITESPACE@[14; 15)
10 IDENT@[15; 18) "Foo"
11 COLON@[18; 19)
12 WHITESPACE@[19; 20)
13 IDENT@[20; 24) "Copy"
14 WHITESPACE@[24; 25)
15 EQ@[25; 26)
16 WHITESPACE@[26; 27)
17 L_PAREN@[27; 28)
18 R_PAREN@[28; 29)
19 SEMI@[29; 30)
20 WHITESPACE@[30; 31)
diff --git a/tests/testutils/src/lib.rs b/tests/testutils/src/lib.rs
index f829b243b..d181e455b 100644
--- a/tests/testutils/src/lib.rs
+++ b/tests/testutils/src/lib.rs
@@ -76,15 +76,14 @@ fn test_from_dir(dir: &Path) -> Vec<PathBuf> {
76fn print_difference(expected: &str, actual: &str, path: &Path) { 76fn print_difference(expected: &str, actual: &str, path: &Path) {
77 let dir = project_dir(); 77 let dir = project_dir();
78 let path = path.strip_prefix(&dir).unwrap_or_else(|_| path); 78 let path = path.strip_prefix(&dir).unwrap_or_else(|_| path);
79 println!("\nfile: {}", path.display());
80 if expected.trim() == actual.trim() { 79 if expected.trim() == actual.trim() {
81 println!("whitespace difference"); 80 println!("whitespace difference, rewriting");
82 println!("rewriting the file");
83 file::put_text(path, actual).unwrap(); 81 file::put_text(path, actual).unwrap();
84 } else { 82 } else {
85 let changeset = Changeset::new(actual, expected, "\n"); 83 let changeset = Changeset::new(actual, expected, "\n");
86 println!("{}", changeset); 84 print!("{}", changeset);
87 } 85 }
86 println!("file: {}\n", path.display());
88 panic!("Comparison failed") 87 panic!("Comparison failed")
89} 88}
90 89