Remove vertical ellipses from tests in complete_snippet.rs and presentation.rs

This commit is contained in:
Phil Ellison 2019-07-28 12:33:21 +01:00
parent 46c07ed578
commit 1b74eed8ca
2 changed files with 94 additions and 102 deletions

View file

@ -84,33 +84,31 @@ mod tests {
#[test] #[test]
fn completes_snippets_in_items() { fn completes_snippets_in_items() {
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_snippet_completion( do_snippet_completion(
r" r"
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
<|> <|>
} }
" "
), ),
@r###" @r###"[
[ CompletionItem {
CompletionItem { label: "Test function",
label: "Test function", source_range: [78; 78),
source_range: [78; 78), delete: [78; 78),
delete: [78; 78), insert: "#[test]\nfn ${1:feature}() {\n $0\n}",
insert: "#[test]\nfn ${1:feature}() {\n $0\n}", kind: Snippet,
kind: Snippet, lookup: "tfn",
lookup: "tfn", },
}, CompletionItem {
CompletionItem { label: "pub(crate)",
label: "pub(crate)", source_range: [78; 78),
source_range: [78; 78), delete: [78; 78),
delete: [78; 78), insert: "pub(crate) $0",
insert: "pub(crate) $0", kind: Snippet,
kind: Snippet, },
}, ]"###
] );
"###
);
} }
} }

View file

@ -194,64 +194,60 @@ mod tests {
fn inserts_parens_for_function_calls() { fn inserts_parens_for_function_calls() {
covers!(inserts_parens_for_function_calls); covers!(inserts_parens_for_function_calls);
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
r" r"
fn no_args() {} fn no_args() {}
fn main() { no_<|> } fn main() { no_<|> }
" "
), ),
@r###" @r###"[
[ CompletionItem {
CompletionItem { label: "main",
label: "main", source_range: [61; 64),
source_range: [61; 64), delete: [61; 64),
delete: [61; 64), insert: "main()$0",
insert: "main()$0", kind: Function,
kind: Function, detail: "fn main()",
detail: "fn main()", },
}, CompletionItem {
CompletionItem { label: "no_args",
label: "no_args", source_range: [61; 64),
source_range: [61; 64), delete: [61; 64),
delete: [61; 64), insert: "no_args()$0",
insert: "no_args()$0", kind: Function,
kind: Function, detail: "fn no_args()",
detail: "fn no_args()", },
}, ]"###
] );
"###
);
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
r" r"
fn with_args(x: i32, y: String) {} fn with_args(x: i32, y: String) {}
fn main() { with_<|> } fn main() { with_<|> }
" "
), ),
@r###" @r###"[
[ CompletionItem {
CompletionItem { label: "main",
label: "main", source_range: [80; 85),
source_range: [80; 85), delete: [80; 85),
delete: [80; 85), insert: "main()$0",
insert: "main()$0", kind: Function,
kind: Function, detail: "fn main()",
detail: "fn main()", },
}, CompletionItem {
CompletionItem { label: "with_args",
label: "with_args", source_range: [80; 85),
source_range: [80; 85), delete: [80; 85),
delete: [80; 85), insert: "with_args($0)",
insert: "with_args($0)", kind: Function,
kind: Function, detail: "fn with_args(x: i32, y: String)",
detail: "fn with_args(x: i32, y: String)", },
}, ]"###
] );
"###
);
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
r" r"
struct S {} struct S {}
impl S { impl S {
fn foo(&self) {} fn foo(&self) {}
@ -260,33 +256,31 @@ mod tests {
s.f<|> s.f<|>
} }
" "
), ),
@r###" @r###"[
[ CompletionItem {
CompletionItem { label: "foo",
label: "foo", source_range: [163; 164),
source_range: [163; 164), delete: [163; 164),
delete: [163; 164), insert: "foo()$0",
insert: "foo()$0", kind: Method,
kind: Method, detail: "fn foo(&self)",
detail: "fn foo(&self)", },
}, ]"###
] );
"###
);
} }
#[test] #[test]
fn dont_render_function_parens_in_use_item() { fn dont_render_function_parens_in_use_item() {
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
" "
//- /lib.rs //- /lib.rs
mod m { pub fn foo() {} } mod m { pub fn foo() {} }
use crate::m::f<|>; use crate::m::f<|>;
" "
), ),
@r#"[ @r#"[
CompletionItem { CompletionItem {
label: "foo", label: "foo",
source_range: [40; 41), source_range: [40; 41),
@ -296,22 +290,22 @@ mod tests {
detail: "pub fn foo()", detail: "pub fn foo()",
}, },
]"# ]"#
); );
} }
#[test] #[test]
fn dont_render_function_parens_if_already_call() { fn dont_render_function_parens_if_already_call() {
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
" "
//- /lib.rs //- /lib.rs
fn frobnicate() {} fn frobnicate() {}
fn main() { fn main() {
frob<|>(); frob<|>();
} }
" "
), ),
@r#"[ @r#"[
CompletionItem { CompletionItem {
label: "frobnicate", label: "frobnicate",
source_range: [35; 39), source_range: [35; 39),
@ -329,10 +323,10 @@ mod tests {
detail: "fn main()", detail: "fn main()",
}, },
]"# ]"#
); );
assert_debug_snapshot_matches!( assert_debug_snapshot_matches!(
do_reference_completion( do_reference_completion(
" "
//- /lib.rs //- /lib.rs
struct Foo {} struct Foo {}
impl Foo { fn new() -> Foo {} } impl Foo { fn new() -> Foo {} }
@ -340,8 +334,8 @@ mod tests {
Foo::ne<|>(); Foo::ne<|>();
} }
" "
), ),
@r#"[ @r#"[
CompletionItem { CompletionItem {
label: "new", label: "new",
source_range: [67; 69), source_range: [67; 69),
@ -351,6 +345,6 @@ mod tests {
detail: "fn new() -> Foo", detail: "fn new() -> Foo",
}, },
]"# ]"#
); );
} }
} }