diff options
| -rw-r--r-- | crates/hir-def/src/attr.rs | 9 | ||||
| -rw-r--r-- | crates/ide/src/runnables.rs | 36 |
2 files changed, 38 insertions, 7 deletions
diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs index 659ca2e9582..3ff58814d17 100644 --- a/crates/hir-def/src/attr.rs +++ b/crates/hir-def/src/attr.rs @@ -273,7 +273,14 @@ impl Attrs { } pub fn is_test(&self) -> bool { - self.by_key("test").exists() + self.iter().any(|x| { + x.path() + .segments() + .iter() + .rev() + .zip(["core", "prelude", "v1", "test"].iter().rev()) + .all(|x| x.0.as_str() == Some(x.1)) + }) } pub fn is_ignore(&self) -> bool { diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 1f331cd9323..9fa0e6449b8 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -589,6 +589,9 @@ fn main() {} #[test] fn test_foo() {} +#[::core::prelude::v1::test] +fn test_full_path() {} + #[test] #[ignore] fn test_foo() {} @@ -600,7 +603,7 @@ mod not_a_root { fn main() {} } "#, - &[TestMod, Bin, Test, Test, Bench], + &[TestMod, Bin, Test, Test, Test, Bench], expect