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 b205e5b commit becdc6e
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 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,72 @@ 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
pub struct TestStruct;
impl<T> trait_dep::TestTrait for TestStruct {
fn some_method(&self) -> Result {
todo!()
}
}
fn main() {
let test_struct = TestStruct;
test_struct.$0
}"#;

check(
fixture,
expect![[r#"
me some_method() (use trait_dep::TestTrait) fn(&self) -> {unknown}
"#]],
);

check_edit(
"some_method",
fixture,
r#"
use trait_dep::TestTrait;
pub struct TestStruct;
impl<T> trait_dep::TestTrait for TestStruct {
fn some_method(&self) -> Result {
todo!()
}
}
fn main() {
let test_struct = TestStruct;
test_struct.some_method()$0
}"#,
);
}

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

0 comments on commit becdc6e

Please sign in to comment.