Skip to content

Commit

Permalink
add non-functioning test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky committed Feb 19, 2024
1 parent 7cb0bb8 commit 4e8e251
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions crates/ide-completion/src/tests/flyimport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,57 @@ fn main() {
);
}

#[test]
fn trait_method_fuzzy_completion_aware_of_fundamental_traits() {
let fixture = r#"
//- /std.rs crate:std
pub mod boxed {
#[lang = "owned_box"]
#[fundamental]
pub struct Box<T>(T);
}
//- /trait-dep.rs crate:trait-dep deps:std
pub trait TestTrait {
fn some_method(&self) -> Result;
}
//- /lib.rs crate:dep deps:std,trait-dep
pub struct TestStruct;
impl<T> trait_dep::TestTrait for TestStruct {
fn some_method(&self) -> Result {
todo!()
}
}
//- /main.rs crate:main deps:dep,trait-dep,std
use dep::TestStruct;
use std::boxed::Box;
fn main() {
let test_struct = TestStruct;
test_struct.$0
}
"#;

check(fixture, expect!["some_method"]);

check_edit(
"fmt",
fixture,
r#"
use dep::TestStruct;
use std::boxed::Box;
fn main() {
let test_struct = Box::new(TestStruct);
test_struct.fmt()$0
}
"#,
);
}

#[test]
fn trait_method_from_alias() {
let fixture = r#"
Expand Down

0 comments on commit 4e8e251

Please sign in to comment.