aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-10-11 16:11:00 +0100
committerAdolfo OchagavĂ­a <[email protected]>2018-10-11 16:11:59 +0100
commit92f5ca64ae09ab996e83acb4017e355437eddc86 (patch)
tree43ddd0e42f738847211f950cd8bc035113828e37
parent5508c91b3e430689e00903d6fe0ad26eb1f00a9f (diff)
Add tests
-rw-r--r--crates/ra_editor/src/typing.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_editor/src/typing.rs
index 3ebdf153e..97ff01e40 100644
--- a/crates/ra_editor/src/typing.rs
+++ b/crates/ra_editor/src/typing.rs
@@ -313,6 +313,62 @@ fn foo() {
313}"); 313}");
314 } 314 }
315 315
316 #[test]
317 fn test_join_lines_normal_comments() {
318 check_join_lines(r"
319fn foo() {
320 // Hello<|>
321 // world!
322}
323", r"
324fn foo() {
325 // Hello<|> world!
326}
327");
328 }
329
330 #[test]
331 fn test_join_lines_doc_comments() {
332 check_join_lines(r"
333fn foo() {
334 /// Hello<|>
335 /// world!
336}
337", r"
338fn foo() {
339 /// Hello<|> world!
340}
341");
342 }
343
344 #[test]
345 fn test_join_lines_mod_comments() {
346 check_join_lines(r"
347fn foo() {
348 //! Hello<|>
349 //! world!
350}
351", r"
352fn foo() {
353 //! Hello<|> world!
354}
355");
356 }
357
358 #[test]
359 fn test_join_lines_multiline_comments() {
360 check_join_lines(r"
361fn foo() {
362 // Hello<|>
363 /* world! */
364}
365", r"
366fn foo() {
367 // Hello<|> world! */
368}
369");
370 }
371
316 fn check_join_lines_sel(before: &str, after: &str) { 372 fn check_join_lines_sel(before: &str, after: &str) {
317 let (sel, before) = extract_range(before); 373 let (sel, before) = extract_range(before);
318 let file = File::parse(&before); 374 let file = File::parse(&before);