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

View file

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