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.rs56
1 files changed, 55 insertions, 1 deletions
diff --git a/crates/libsyntax2/tests/test/main.rs b/crates/libsyntax2/tests/test/main.rs
index 644df9f3c..ce7e075f8 100644
--- a/crates/libsyntax2/tests/test/main.rs
+++ b/crates/libsyntax2/tests/test/main.rs
@@ -33,7 +33,7 @@ fn reparse_test() {
33 let incrementally_reparsed = { 33 let incrementally_reparsed = {
34 let f = File::parse(&before); 34 let f = File::parse(&before);
35 let edit = AtomEdit { delete: range, insert: replace_with.to_string() }; 35 let edit = AtomEdit { delete: range, insert: replace_with.to_string() };
36 f.incremental_reparse(&edit).unwrap() 36 f.incremental_reparse(&edit).expect("cannot incrementally reparse")
37 }; 37 };
38 assert_eq_text!( 38 assert_eq_text!(
39 &dump_tree(fully_reparsed.syntax()), 39 &dump_tree(fully_reparsed.syntax()),
@@ -47,6 +47,11 @@ fn foo() {
47} 47}
48", "baz"); 48", "baz");
49 do_check(r" 49 do_check(r"
50fn foo() {
51 let x = foo<|> + bar<|>
52}
53", "baz");
54 do_check(r"
50struct Foo { 55struct Foo {
51 f: foo<|><|> 56 f: foo<|><|>
52} 57}
@@ -69,6 +74,11 @@ trait Foo {
69} 74}
70", "Output"); 75", "Output");
71 do_check(r" 76 do_check(r"
77trait Foo {
78 type<|> Foo<|>;
79}
80", "Output");
81 do_check(r"
72impl IntoIterator<Item=i32> for Foo { 82impl IntoIterator<Item=i32> for Foo {
73 f<|><|> 83 f<|><|>
74} 84}
@@ -94,6 +104,50 @@ extern {
94 fn<|>;<|> 104 fn<|>;<|>
95} 105}
96", " exit(code: c_int)"); 106", " exit(code: c_int)");
107do_check(r"<|><|>
108fn foo() -> i32 {
109 1
110}
111", "\n\n\n \n");
112 do_check(r"
113fn foo() -> <|><|> {}
114", " \n");
115 do_check(r"
116fn <|>foo<|>() -> i32 {
117 1
118}
119", "bar");
120do_check(r"
121fn aa<|><|>bb() {
122
123}
124", "foofoo");
125 do_check(r"
126fn aabb /* <|><|> */ () {
127
128}
129", "some comment");
130 do_check(r"
131fn aabb <|><|> () {
132
133}
134", " \t\t\n\n");
135 do_check(r"
136trait foo {
137// comment <|><|>
138}
139", "\n");
140 do_check(r"
141/// good <|><|>omment
142mod {
143}
144", "c");
145 do_check(r#"
146fn -> &str { "Hello<|><|>" }
147"#, ", world");
148 do_check(r#"
149fn -> &str { // "Hello<|><|>"
150"#, ", world");
97} 151}
98 152
99#[test] 153#[test]