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

Commit

Permalink
[TouchRunner] Fix test filtering. (#86)
Browse files Browse the repository at this point in the history
If our filter subclasses TestFilter and overrides TestFilter.Match, we must
also call TestFilter.Match for any nested filters to get the correct behavior.
  • Loading branch information
rolfbjarne authored Aug 4, 2020
1 parent c4a1cd1 commit 6cf8d0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions NUnitLite/TouchRunner/TouchRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public void Run (Test test)
#if NUNITLITE_NUGET
var filter = new MatchTestFilter { MatchTest = test };
if (this.filter != null)
filter.AndFilters.Add (this.filter);
filter.AndFilters.Add ((TestFilter) this.filter);
if (ExcludedCategories != null)
filter.AndFilters.Add (new ExcludeCategoryFilter (ExcludedCategories));
foreach (var runner in runners)
Expand Down Expand Up @@ -885,7 +885,7 @@ protected override void ExecuteOnMainThread (Action action)
// A filter that matches a specific test
class MatchTestFilter : TestFilter {
public ITest MatchTest;
public List<ITestFilter> AndFilters = new List<ITestFilter> ();
public List<TestFilter> AndFilters = new List<TestFilter> ();

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

Expand Down

0 comments on commit 6cf8d0b

Please sign in to comment.