From 380a2870c73be5c03512b5711988d760cd21cca6 Mon Sep 17 00:00:00 2001 From: Hannes De Valkeneer Date: Wed, 22 Apr 2020 22:52:12 +0200 Subject: feat: run ignored tests --- crates/ra_ide/src/runnables.rs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 9433f3a24..05a66e03c 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs @@ -34,7 +34,7 @@ impl Display for TestId { #[derive(Debug)] pub enum RunnableKind { - Test { test_id: TestId }, + Test { test_id: TestId, attr: TestAttr }, TestMod { path: String }, Bench { test_id: TestId }, Bin, @@ -77,7 +77,8 @@ fn runnable_fn(sema: &Semantics, fn_def: ast::FnDef) -> Option, fn_def: ast::FnDef) -> Option TestAttr { + let ignore = fn_def + .attrs() + .filter_map(|attr| attr.simple_name()) + .any(|attribute_text| attribute_text == "ignore"); + TestAttr { ignore } + } +} + /// This is a method with a heuristics to support test methods annotated with custom test annotations, such as /// `#[test_case(...)]`, `#[tokio::test]` and similar. /// Also a regular `#[test]` annotation is supported. @@ -157,6 +173,9 @@ mod tests { test_id: Path( "test_foo", ), + attr: TestAttr { + ignore: false, + }, }, }, Runnable { @@ -165,6 +184,9 @@ mod tests { test_id: Path( "test_foo", ), + attr: TestAttr { + ignore: true, + }, }, }, ] @@ -200,6 +222,9 @@ mod tests { test_id: Path( "test_mod::test_foo1", ), + attr: TestAttr { + ignore: false, + }, }, }, ] @@ -237,6 +262,9 @@ mod tests { test_id: Path( "foo::test_mod::test_foo1", ), + attr: TestAttr { + ignore: false, + }, }, }, ] @@ -276,6 +304,9 @@ mod tests { test_id: Path( "foo::bar::test_mod::test_foo1", ), + attr: TestAttr { + ignore: false, + }, }, }, ] -- cgit v1.2.3