From 5da941897d4ed092a219729d7980bd103907850a Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 31 Oct 2019 20:42:57 +0100 Subject: [PATCH] Add failing tests for trait assoc method completion --- .../src/completion/complete_path.rs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index a58fdc036f..b471787ebe 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -558,6 +558,66 @@ mod tests { ); } + #[test] + fn completes_trait_associated_method_1() { + assert_debug_snapshot!( + do_reference_completion( + " + //- /lib.rs + trait Trait { + /// A trait method + fn m(); + } + + fn foo() { let _ = Trait::<|> } + " + ), + @"[]" + ); + } + + #[test] + fn completes_trait_associated_method_2() { + assert_debug_snapshot!( + do_reference_completion( + " + //- /lib.rs + trait Trait { + /// A trait method + fn m(); + } + + struct S; + impl Trait for S {} + + fn foo() { let _ = S::<|> } + " + ), + @"[]" + ); + } + + #[test] + fn completes_trait_associated_method_3() { + assert_debug_snapshot!( + do_reference_completion( + " + //- /lib.rs + trait Trait { + /// A trait method + fn m(); + } + + struct S; + impl Trait for S {} + + fn foo() { let _ = ::<|> } + " + ), + @"[]" + ); + } + #[test] fn completes_type_alias() { assert_debug_snapshot!(