aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-11 11:49:17 +0000
committerAleksey Kladov <[email protected]>2020-03-11 11:58:16 +0000
commit90fe534f036b69c220c9db537e736e77508c4d31 (patch)
tree96e86ac62ddf391f64133917888cc058b2b17884 /crates/ra_ide/src
parent52da9e90a6002eb712175f7c8d76a472cf966d8e (diff)
Split on enter tests
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/typing/on_enter.rs43
1 files changed, 28 insertions, 15 deletions
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs
index 359794f67..7c979694d 100644
--- a/crates/ra_ide/src/typing/on_enter.rs
+++ b/crates/ra_ide/src/typing/on_enter.rs
@@ -100,7 +100,7 @@ mod tests {
100 } 100 }
101 101
102 #[test] 102 #[test]
103 fn test_on_enter() { 103 fn continues_doc_comment() {
104 do_check( 104 do_check(
105 r" 105 r"
106/// Some docs<|> 106/// Some docs<|>
@@ -114,6 +114,7 @@ fn foo() {
114} 114}
115", 115",
116 ); 116 );
117
117 do_check( 118 do_check(
118 r" 119 r"
119impl S { 120impl S {
@@ -129,34 +130,48 @@ impl S {
129} 130}
130", 131",
131 ); 132 );
133
132 do_check( 134 do_check(
133 r" 135 r"
134fn main() { 136///<|> Some docs
135 // Fix<|> me 137fn foo() {
136 let x = 1 + 1;
137} 138}
138", 139",
139 r" 140 r"
140fn main() { 141///
141 // Fix 142/// <|> Some docs
142 // <|> me 143fn foo() {
143 let x = 1 + 1;
144} 144}
145", 145",
146 ); 146 );
147 }
148
149 #[test]
150 fn does_not_continue_before_doc_comment() {
151 do_check_noop(r"<|>//! docz");
152 }
153
154 #[test]
155 fn continues_code_comment_in_the_middle() {
147 do_check( 156 do_check(
148 r" 157 r"
149///<|> Some docs 158fn main() {
150fn foo() { 159 // Fix<|> me
160 let x = 1 + 1;
151} 161}
152", 162",
153 r" 163 r"
154/// 164fn main() {
155/// <|> Some docs 165 // Fix
156fn foo() { 166 // <|> me
167 let x = 1 + 1;
157} 168}
158", 169",
159 ); 170 );
171 }
172
173 #[test]
174 fn does_not_continue_end_of_code_comment() {
160 do_check_noop( 175 do_check_noop(
161 r" 176 r"
162fn main() { 177fn main() {
@@ -165,7 +180,5 @@ fn main() {
165} 180}
166", 181",
167 ); 182 );
168
169 do_check_noop(r"<|>//! docz");
170 } 183 }
171} 184}