]> git.lizzy.rs Git - rust.git/commitdiff
fold complete_postfix tests into one
authorHoàng Đức Hiếu <code@hdhoang.space>
Sun, 3 Feb 2019 13:12:57 +0000 (20:12 +0700)
committerHoàng Đức Hiếu <code@hdhoang.space>
Sun, 3 Feb 2019 13:12:57 +0000 (20:12 +0700)
crates/ra_ide_api/src/completion/complete_postfix.rs
crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion1.snap [deleted file]
crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion2.snap [deleted file]
crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion3.snap [deleted file]
crates/ra_ide_api/src/completion/snapshots/completion_item__filter_postfix_completion4.snap [deleted file]
crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap [new file with mode: 0644]

index af25452b8306c7a344fcacc51abac012e2554816..e3a739d6da5b824b3e908ac5455e4ce71c0190cf 100644 (file)
@@ -56,9 +56,9 @@ fn check_snippet_completion(test_name: &str, code: &str) {
     }
 
     #[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 @@ fn main() {
             "#,
         );
     }
-
-    #[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 (file)
index 840ec48..0000000
+++ /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 (file)
index b46366d..0000000
+++ /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 (file)
index 3f865cf..0000000
+++ /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 (file)
index da1033e..0000000
+++ /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 (file)
index 0000000..bc886ef
--- /dev/null
@@ -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: ""
+                    }
+                ]
+            }
+        )
+    }
+]