From 1bfc3a50c0febbfa9b56de01997d081814d98e39 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 31 Dec 2020 02:18:15 +0200 Subject: Add a basic test for the trait fuzzy import --- crates/hir_def/src/import_map.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'crates/hir_def') diff --git a/crates/hir_def/src/import_map.rs b/crates/hir_def/src/import_map.rs index 30b22f51d..810a4a268 100644 --- a/crates/hir_def/src/import_map.rs +++ b/crates/hir_def/src/import_map.rs @@ -748,6 +748,30 @@ mod tests { ); } + #[test] + fn fuzzy_import_trait() { + let ra_fixture = r#" + //- /main.rs crate:main deps:dep + //- /dep.rs crate:dep + pub mod fmt { + pub trait Display { + fn fmttt(); + } + } + "#; + + check_search( + ra_fixture, + "main", + Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy), + expect![[r#" + dep::fmt (t) + dep::fmt::Display (t) + dep::fmt::Display::fmttt (f) + "#]], + ); + } + #[test] fn search_mode() { let ra_fixture = r#" -- cgit v1.2.3