aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_snippet.rs
diff options
context:
space:
mode:
authorPhil Ellison <[email protected]>2019-07-28 12:08:06 +0100
committerPhil Ellison <[email protected]>2019-07-28 12:08:06 +0100
commit5c4df97996ac88133c12069debff1f86d3a9f7cb (patch)
tree50191919a9d6462b1edafff44df9c36449d89cc4 /crates/ra_ide_api/src/completion/complete_snippet.rs
parent9f6909c0ce678e738a39789687af8a12e02d0be1 (diff)
cargo format
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_snippet.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index 063b69319..e0368b3b2 100644
--- a/crates/ra_ide_api/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
@@ -40,7 +40,7 @@ fn ${1:feature}() {
40#[cfg(test)] 40#[cfg(test)]
41mod tests { 41mod tests {
42 use crate::completion::{do_completion, CompletionItem, CompletionKind}; 42 use crate::completion::{do_completion, CompletionItem, CompletionKind};
43 use insta::assert_debug_snapshot_matches; 43 use insta::assert_debug_snapshot_matches;
44 44
45 fn do_snippet_completion(code: &str) -> Vec<CompletionItem> { 45 fn do_snippet_completion(code: &str) -> Vec<CompletionItem> {
46 do_completion(code, CompletionKind::Snippet) 46 do_completion(code, CompletionKind::Snippet)
@@ -49,8 +49,8 @@ mod tests {
49 #[test] 49 #[test]
50 fn completes_snippets_in_expressions() { 50 fn completes_snippets_in_expressions() {
51 assert_debug_snapshot_matches!( 51 assert_debug_snapshot_matches!(
52 do_snippet_completion(r"fn foo(x: i32) { <|> }"), 52 do_snippet_completion(r"fn foo(x: i32) { <|> }"),
53@r#"[ 53 @r#"[
54 CompletionItem { 54 CompletionItem {
55 label: "pd", 55 label: "pd",
56 source_range: [17; 17), 56 source_range: [17; 17),
@@ -66,33 +66,33 @@ mod tests {
66 kind: Snippet, 66 kind: Snippet,
67 }, 67 },
68]"# 68]"#
69 ); 69 );
70 } 70 }
71 71
72 #[test] 72 #[test]
73 fn should_not_complete_snippets_in_path() { 73 fn should_not_complete_snippets_in_path() {
74 assert_debug_snapshot_matches!( 74 assert_debug_snapshot_matches!(
75 do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), 75 do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"),
76@r#"[]"# 76 @r#"[]"#
77 ); 77 );
78 assert_debug_snapshot_matches!( 78 assert_debug_snapshot_matches!(
79 do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), 79 do_snippet_completion(r"fn foo(x: i32) { ::<|> }"),
80@r#"[]"# 80 @r#"[]"#
81 ); 81 );
82 } 82 }
83 83
84 #[test] 84 #[test]
85 fn completes_snippets_in_items() { 85 fn completes_snippets_in_items() {
86 assert_debug_snapshot_matches!( 86 assert_debug_snapshot_matches!(
87 do_snippet_completion( 87 do_snippet_completion(
88 r" 88 r"
89 #[cfg(test)] 89 #[cfg(test)]
90 mod tests { 90 mod tests {
91 <|> 91 <|>
92 } 92 }
93 " 93 "
94 ), 94 ),
95@r###" 95 @r###"
96 ⋮[ 96 ⋮[
97 ⋮ CompletionItem { 97 ⋮ CompletionItem {
98 ⋮ label: "Test function", 98 ⋮ label: "Test function",
@@ -111,6 +111,6 @@ mod tests {
111 ⋮ }, 111 ⋮ },
112 ⋮] 112 ⋮]
113 "### 113 "###
114 ); 114 );
115 } 115 }
116} 116}