aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/tests/test')
-rw-r--r--crates/libsyntax2/tests/test/main.rs61
1 files changed, 46 insertions, 15 deletions
diff --git a/crates/libsyntax2/tests/test/main.rs b/crates/libsyntax2/tests/test/main.rs
index 014faa2c6..24058efa9 100644
--- a/crates/libsyntax2/tests/test/main.rs
+++ b/crates/libsyntax2/tests/test/main.rs
@@ -24,21 +24,6 @@ fn lexer_tests() {
24} 24}
25 25
26#[test] 26#[test]
27fn parser_tests() {
28 dir_tests(&["parser/inline", "parser/ok", "parser/err"], |text| {
29 let file = File::parse(text);
30 dump_tree(file.syntax())
31 })
32}
33
34#[test]
35fn parser_fuzz_tests() {
36 for (_, text) in collect_tests(&["parser/fuzz-failures"]) {
37 check_fuzz_invariants(&text)
38 }
39}
40
41#[test]
42fn reparse_test() { 27fn reparse_test() {
43 fn do_check(before: &str, replace_with: &str) { 28 fn do_check(before: &str, replace_with: &str) {
44 let (range, before) = extract_range(before); 29 let (range, before) = extract_range(before);
@@ -73,6 +58,52 @@ fn foo {
73 <|>92<|>; 58 <|>92<|>;
74} 59}
75", "62"); 60", "62");
61 do_check(r"
62mod foo {
63 fn <|><|>
64}
65", "bar");
66 do_check(r"
67trait Foo {
68 type <|>Foo<|>;
69}
70", "Output");
71 do_check(r"
72impl IntoIterator<Item=i32> for Foo {
73 f<|><|>
74}
75", "n next(");
76 do_check(r"
77use a::b::{foo,<|>,bar<|>};
78 ", "baz");
79 do_check(r"
80pub enum A {
81 Foo<|><|>
82}
83", "\nBar;\n");
84 do_check(r"
85foo!{a, b<|><|> d}
86", ", c[3]");
87 do_check(r"
88extern {
89 fn<|>;<|>
90}
91", " exit(code: c_int)");
92}
93
94#[test]
95fn parser_tests() {
96 dir_tests(&["parser/inline", "parser/ok", "parser/err"], |text| {
97 let file = File::parse(text);
98 dump_tree(file.syntax())
99 })
100}
101
102#[test]
103fn parser_fuzz_tests() {
104 for (_, text) in collect_tests(&["parser/fuzz-failures"]) {
105 check_fuzz_invariants(&text)
106 }
76} 107}
77 108
78 109