From 0bbd6428ad786cf60d5c79d0ac2aae6dac7dc1a5 Mon Sep 17 00:00:00 2001 From: BGluth Date: Fri, 26 Jun 2020 12:30:00 -0600 Subject: Added tests for no auto-completion on comments --- crates/ra_ide/src/completion/presentation.rs | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'crates/ra_ide/src/completion') diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 4fdc2f0bb..b18279746 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs @@ -1516,4 +1516,54 @@ mod tests { "### ); } + + #[test] + fn no_keyword_autocompletion_on_line_comments() { + assert_debug_snapshot!( + do_completion( + r" + fn test() { + let x = 2; // A comment<|> + } + ", + CompletionKind::Keyword + ), + @r###" + [] + "### + ); + } + + #[test] + fn no_keyword_autocompletion_on_multi_line_comments() { + assert_debug_snapshot!( + do_completion( + r" + /* + Some multi-line comment<|> + */ + ", + CompletionKind::Keyword + ), + @r###" + [] + "### + ); + } + + #[test] + fn no_keyword_autocompletion_on_doc_comments() { + assert_debug_snapshot!( + do_completion( + r" + /// Some doc comment + /// let test<|> = 1 + ", + CompletionKind::Keyword + ), + @r###" + [] + "### + ); + } } -- cgit v1.2.3