Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 6cf8d0b

Browse files
authored
[TouchRunner] Fix test filtering. (#86)
If our filter subclasses TestFilter and overrides TestFilter.Match, we must also call TestFilter.Match for any nested filters to get the correct behavior.
1 parent c4a1cd1 commit 6cf8d0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

NUnitLite/TouchRunner/TouchRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ public void Run (Test test)
595595
#if NUNITLITE_NUGET
596596
var filter = new MatchTestFilter { MatchTest = test };
597597
if (this.filter != null)
598-
filter.AndFilters.Add (this.filter);
598+
filter.AndFilters.Add ((TestFilter) this.filter);
599599
if (ExcludedCategories != null)
600600
filter.AndFilters.Add (new ExcludeCategoryFilter (ExcludedCategories));
601601
foreach (var runner in runners)
@@ -885,7 +885,7 @@ protected override void ExecuteOnMainThread (Action action)
885885
// A filter that matches a specific test
886886
class MatchTestFilter : TestFilter {
887887
public ITest MatchTest;
888-
public List<ITestFilter> AndFilters = new List<ITestFilter> ();
888+
public List<TestFilter> AndFilters = new List<TestFilter> ();
889889

890890
#if NUNITLITE_NUGET
891891
public override TNode AddToXml (TNode parentNode, bool recursive)
@@ -898,7 +898,7 @@ public override bool Match (ITest test)
898898
{
899899
if (AndFilters != null) {
900900
// If any of the And filters returns false, then return false too.
901-
if (AndFilters.Any ((v) => !v.Pass (test)))
901+
if (AndFilters.Any ((v) => !v.Match (test)))
902902
return false;
903903
}
904904

0 commit comments

Comments
 (0)