From 2e8f3fee3fc15355fc2d512ace5817e9119e504b Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 7 Jul 2021 19:54:58 +0200 Subject: [PATCH] Add test for trait completion label edit --- crates/ide_completion/src/completions/dot.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs index a2913015f63..67ffafa6c2b 100644 --- a/crates/ide_completion/src/completions/dot.rs +++ b/crates/ide_completion/src/completions/dot.rs @@ -101,7 +101,10 @@ fn complete_methods( mod tests { use expect_test::{expect, Expect}; - use crate::{tests::filtered_completion_list, CompletionKind}; + use crate::{ + tests::{check_edit, filtered_completion_list}, + CompletionKind, + }; fn check(ra_fixture: &str, expect: Expect) { let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference); @@ -253,6 +256,21 @@ fn foo(a: A) { a.$0 } me the_method() (as Trait) fn(&self) "#]], ); + check_edit( + "the_method", + r#" +struct A {} +trait Trait { fn the_method(&self); } +impl Trait for A {} +fn foo(a: A) { a.$0 } +"#, + r#" +struct A {} +trait Trait { fn the_method(&self); } +impl Trait for A {} +fn foo(a: A) { a.the_method()$0 } +"#, + ); } #[test]