From 90fe534f036b69c220c9db537e736e77508c4d31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 11 Mar 2020 12:49:17 +0100 Subject: Split on enter tests --- crates/ra_ide/src/typing/on_enter.rs | 43 +++++++++++++++++++++++------------- 1 file 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 { } #[test] - fn test_on_enter() { + fn continues_doc_comment() { do_check( r" /// Some docs<|> @@ -114,6 +114,7 @@ fn foo() { } ", ); + do_check( r" impl S { @@ -129,34 +130,48 @@ impl S { } ", ); + do_check( r" -fn main() { - // Fix<|> me - let x = 1 + 1; +///<|> Some docs +fn foo() { } ", r" -fn main() { - // Fix - // <|> me - let x = 1 + 1; +/// +/// <|> Some docs +fn foo() { } ", ); + } + + #[test] + fn does_not_continue_before_doc_comment() { + do_check_noop(r"<|>//! docz"); + } + + #[test] + fn continues_code_comment_in_the_middle() { do_check( r" -///<|> Some docs -fn foo() { +fn main() { + // Fix<|> me + let x = 1 + 1; } ", r" -/// -/// <|> Some docs -fn foo() { +fn main() { + // Fix + // <|> me + let x = 1 + 1; } ", ); + } + + #[test] + fn does_not_continue_end_of_code_comment() { do_check_noop( r" fn main() { @@ -165,7 +180,5 @@ fn main() { } ", ); - - do_check_noop(r"<|>//! docz"); } } -- cgit v1.2.3