diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-09-11 08:32:36 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-09-11 08:32:36 +0100 |
commit | e240360ee282b4f5936748cc07d6ceb3be5d6bb2 (patch) | |
tree | 0affc5f30030d0702fb2bf6c4d9c0a84a5a6732f /crates/libsyntax2/tests | |
parent | 505895a25f98423de07c3cec4793b66a19d098c7 (diff) | |
parent | d0cfeb4f1616e125ca3a941f2dcf5dfbb5f2b03f (diff) |
Merge #68
68: Implement incremental reparsing for remaining braced blocks r=matklad a=darksv
Fixes #66
Co-authored-by: darksv <[email protected]>
Diffstat (limited to 'crates/libsyntax2/tests')
-rw-r--r-- | crates/libsyntax2/tests/test/main.rs | 66 |
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] |
27 | fn 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] | ||
35 | fn parser_fuzz_tests() { | ||
36 | for (_, text) in collect_tests(&["parser/fuzz-failures"]) { | ||
37 | check_fuzz_invariants(&text) | ||
38 | } | ||
39 | } | ||
40 | |||
41 | #[test] | ||
42 | fn reparse_test() { | 27 | fn 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" | ||
62 | mod foo { | ||
63 | fn <|><|> | ||
64 | } | ||
65 | ", "bar"); | ||
66 | do_check(r" | ||
67 | trait Foo { | ||
68 | type <|>Foo<|>; | ||
69 | } | ||
70 | ", "Output"); | ||
71 | do_check(r" | ||
72 | impl IntoIterator<Item=i32> for Foo { | ||
73 | f<|><|> | ||
74 | } | ||
75 | ", "n next("); | ||
76 | do_check(r" | ||
77 | use a::b::{foo,<|>,bar<|>}; | ||
78 | ", "baz"); | ||
79 | do_check(r" | ||
80 | pub enum A { | ||
81 | Foo<|><|> | ||
82 | } | ||
83 | ", "\nBar;\n"); | ||
84 | do_check(r" | ||
85 | foo!{a, b<|><|> d} | ||
86 | ", ", c[3]"); | ||
87 | do_check(r" | ||
88 | fn foo() { | ||
89 | vec![<|><|>] | ||
90 | } | ||
91 | ", "123"); | ||
92 | do_check(r" | ||
93 | extern { | ||
94 | fn<|>;<|> | ||
95 | } | ||
96 | ", " exit(code: c_int)"); | ||
97 | } | ||
98 | |||
99 | #[test] | ||
100 | fn 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] | ||
108 | fn parser_fuzz_tests() { | ||
109 | for (_, text) in collect_tests(&["parser/fuzz-failures"]) { | ||
110 | check_fuzz_invariants(&text) | ||
111 | } | ||
76 | } | 112 | } |
77 | 113 | ||
78 | 114 | ||