aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/tests/test/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/tests/test/main.rs')
-rw-r--r--crates/libsyntax2/tests/test/main.rs66
1 files changed, 51 insertions, 15 deletions
diff --git a/crates/libsyntax2/tests/test/main.rs b/crates/libsyntax2/tests/test/main.rs
index 014faa2c6..644df9f3c 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,57 @@ 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"
88fn foo() {
89 vec![<|><|>]
90}
91", "123");
92 do_check(r"
93extern {
94 fn<|>;<|>
95}
96", " exit(code: c_int)");
97}
98
99#[test]
100fn parser_tests() {
101 dir_tests(&["parser/inline", "parser/ok", "parser/err"], |text| {
102 let file = File::parse(text);
103 dump_tree(file.syntax())
104 })
105}
106
107#[test]
108fn parser_fuzz_tests() {
109 for (_, text) in collect_tests(&["parser/fuzz-failures"]) {
110 check_fuzz_invariants(&text)
111 }
76} 112}
77 113
78 114