Add tests for checking the impl self type

This commit is contained in:
Florian Diebold 2019-12-02 19:27:31 +01:00
parent cfa50df33e
commit a5a07bde04
2 changed files with 47 additions and 0 deletions

View file

@ -216,6 +216,39 @@ mod tests {
);
}
#[test]
fn test_method_completion_only_fitting_impls() {
assert_debug_snapshot!(
do_ref_completion(
r"
struct A<T> {}
impl A<u32> {
fn the_method(&self) {}
}
impl A<i32> {
fn the_other_method(&self) {}
}
fn foo(a: A<u32>) {
a.<|>
}
",
),
@r###"
[
CompletionItem {
label: "the_method()",
source_range: [243; 243),
delete: [243; 243),
insert: "the_method()$0",
kind: Method,
lookup: "the_method",
detail: "fn the_method(&self)",
},
]
"###
);
}
#[test]
fn test_trait_method_completion() {
assert_debug_snapshot!(