From 9dd7ccf609745334ece375b5cf0918131365b7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20=C4=90=E1=BB=A9c=20Hi=E1=BA=BFu?= Date: Sun, 3 Feb 2019 20:12:57 +0700 Subject: fold complete_postfix tests into one --- .../ra_ide_api/src/completion/complete_postfix.rs | 43 +------ ...ompletion_item__filter_postfix_completion1.snap | 123 --------------------- ...ompletion_item__filter_postfix_completion2.snap | 123 --------------------- ...ompletion_item__filter_postfix_completion3.snap | 123 --------------------- ...ompletion_item__filter_postfix_completion4.snap | 123 --------------------- ...mpletion_works_for_trivial_path_expression.snap | 123 +++++++++++++++++++++ 6 files changed, 125 insertions(+), 533 deletions(-) delete mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap delete mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap delete mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap delete mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap create mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index af25452b8..e3a739d6d 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -56,9 +56,9 @@ mod tests { } #[test] - fn test_filter_postfix_completion1() { + fn postfix_completion_works_for_trivial_path_expression() { check_snippet_completion( - "filter_postfix_completion1", + "postfix_completion_works_for_trivial_path_expression", r#" fn main() { let bar = "a"; @@ -67,43 +67,4 @@ mod tests { "#, ); } - - #[test] - fn test_filter_postfix_completion2() { - check_snippet_completion( - "filter_postfix_completion2", - r#" - fn main() { - let bar = "a"; - bar.i<|> - } - "#, - ); - } - - #[test] - fn test_filter_postfix_completion3() { - check_snippet_completion( - "filter_postfix_completion3", - r#" - fn main() { - let bar = "a"; - bar.if<|> - } - "#, - ); - } - - #[test] - fn test_filter_postfix_completion4() { - check_snippet_completion( - "filter_postfix_completion4", - r#" - fn main() { - let bar = "a"; - bar.dbg<|> - } - "#, - ); - } } diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap deleted file mode 100644 index 840ec4881..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap +++ /dev/null @@ -1,123 +0,0 @@ ---- -created: "2019-02-02T15:08:34.016389802+00:00" -creator: insta@0.5.3 -expression: kind_completions -source: crates/ra_ide_api/src/completion/completion_item.rs ---- -[ - CompletionItem { - completion_kind: Postfix, - label: "dbg", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "dbg!(bar)" - ), - insert_text_format: Snippet, - source_range: [76; 76), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "if", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "if bar {$0}" - ), - insert_text_format: Snippet, - source_range: [76; 76), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "match", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "match bar {\n${1:_} => {$0\\},\n}" - ), - insert_text_format: Snippet, - source_range: [76; 76), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "not", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "!bar" - ), - insert_text_format: Snippet, - source_range: [76; 76), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "while", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "while bar {\n$0\n}" - ), - insert_text_format: Snippet, - source_range: [76; 76), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - } -] diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap deleted file mode 100644 index b46366d88..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap +++ /dev/null @@ -1,123 +0,0 @@ ---- -created: "2019-02-02T15:08:34.016388824+00:00" -creator: insta@0.5.3 -expression: kind_completions -source: crates/ra_ide_api/src/completion/completion_item.rs ---- -[ - CompletionItem { - completion_kind: Postfix, - label: "dbg", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "dbg!(bar)" - ), - insert_text_format: Snippet, - source_range: [76; 77), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "if", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "if bar {$0}" - ), - insert_text_format: Snippet, - source_range: [76; 77), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "match", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "match bar {\n${1:_} => {$0\\},\n}" - ), - insert_text_format: Snippet, - source_range: [76; 77), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "not", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "!bar" - ), - insert_text_format: Snippet, - source_range: [76; 77), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "while", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "while bar {\n$0\n}" - ), - insert_text_format: Snippet, - source_range: [76; 77), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 76), - insert: "" - } - ] - } - ) - } -] diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap deleted file mode 100644 index 3f865cf93..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap +++ /dev/null @@ -1,123 +0,0 @@ ---- -created: "2019-02-02T15:08:34.060136941+00:00" -creator: insta@0.5.3 -expression: kind_completions -source: crates/ra_ide_api/src/completion/completion_item.rs ---- -[ - CompletionItem { - completion_kind: Postfix, - label: "dbg", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "dbg!(bar)" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "if", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "if bar {$0}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "match", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "match bar {\n${1:_} => {$0\\},\n}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "not", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "!bar" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "while", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "while bar {\n$0\n}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - } -] diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap deleted file mode 100644 index da1033e7c..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap +++ /dev/null @@ -1,123 +0,0 @@ ---- -created: "2019-02-02T15:08:34.069147268+00:00" -creator: insta@0.5.3 -expression: kind_completions -source: crates/ra_ide_api/src/completion/completion_item.rs ---- -[ - CompletionItem { - completion_kind: Postfix, - label: "dbg", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "dbg!(bar)" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "if", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "if bar {$0}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "match", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "match bar {\n${1:_} => {$0\\},\n}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "not", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "!bar" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - }, - CompletionItem { - completion_kind: Postfix, - label: "while", - kind: None, - detail: None, - documentation: None, - lookup: None, - insert_text: Some( - "while bar {\n$0\n}" - ), - insert_text_format: Snippet, - source_range: [78; 78), - text_edit: Some( - TextEdit { - atoms: [ - AtomTextEdit { - delete: [72; 78), - insert: "" - } - ] - } - ) - } -] diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap new file mode 100644 index 000000000..bc886ef0b --- /dev/null +++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap @@ -0,0 +1,123 @@ +--- +created: "2019-02-03T11:38:42.897384636+00:00" +creator: insta@0.5.3 +expression: kind_completions +source: crates/ra_ide_api/src/completion/completion_item.rs +--- +[ + CompletionItem { + completion_kind: Postfix, + label: "dbg", + kind: None, + detail: None, + documentation: None, + lookup: None, + insert_text: Some( + "dbg!(bar)" + ), + insert_text_format: Snippet, + source_range: [76; 76), + text_edit: Some( + TextEdit { + atoms: [ + AtomTextEdit { + delete: [72; 76), + insert: "" + } + ] + } + ) + }, + CompletionItem { + completion_kind: Postfix, + label: "if", + kind: None, + detail: None, + documentation: None, + lookup: None, + insert_text: Some( + "if bar {$0}" + ), + insert_text_format: Snippet, + source_range: [76; 76), + text_edit: Some( + TextEdit { + atoms: [ + AtomTextEdit { + delete: [72; 76), + insert: "" + } + ] + } + ) + }, + CompletionItem { + completion_kind: Postfix, + label: "match", + kind: None, + detail: None, + documentation: None, + lookup: None, + insert_text: Some( + "match bar {\n${1:_} => {$0\\},\n}" + ), + insert_text_format: Snippet, + source_range: [76; 76), + text_edit: Some( + TextEdit { + atoms: [ + AtomTextEdit { + delete: [72; 76), + insert: "" + } + ] + } + ) + }, + CompletionItem { + completion_kind: Postfix, + label: "not", + kind: None, + detail: None, + documentation: None, + lookup: None, + insert_text: Some( + "!bar" + ), + insert_text_format: Snippet, + source_range: [76; 76), + text_edit: Some( + TextEdit { + atoms: [ + AtomTextEdit { + delete: [72; 76), + insert: "" + } + ] + } + ) + }, + CompletionItem { + completion_kind: Postfix, + label: "while", + kind: None, + detail: None, + documentation: None, + lookup: None, + insert_text: Some( + "while bar {\n$0\n}" + ), + insert_text_format: Snippet, + source_range: [76; 76), + text_edit: Some( + TextEdit { + atoms: [ + AtomTextEdit { + delete: [72; 76), + insert: "" + } + ] + } + ) + } +] -- cgit v1.2.3