Skip to content

Commit

Permalink
fix(includes): Properly override base method on file filter (#161)
Browse files Browse the repository at this point in the history
* Fix Method Override

* Remove Test Code
  • Loading branch information
AndyTWF authored Aug 25, 2021
1 parent 22aae4a commit a590844
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Compiler/Input/Filter/ExcludeFileFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public ExcludeFileFilter(IEnumerable<string> fileNames) : base(fileNames)
{
}

public new bool Filter(string path)
public override bool Filter(string path)
{
return !base.Filter(path);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Input/Filter/IncludeFileFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public IncludeFileFilter(IEnumerable<string> fileNames)
FileNames = fileNames;
}

public bool Filter(string path)
public virtual bool Filter(string path)
{
return FileNames.Contains(Path.GetFileName(path));
}
Expand Down
8 changes: 8 additions & 0 deletions tests/CompilerTest/Input/Filter/ExcludeFileFilterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,13 @@ public void ItDoesntFilterIfNotMatch()
filter.Filter("_TestData/abc/NotFoo.txt")
);
}

[Fact]
public void ItOverridesBaseFilter()
{
Assert.False(
((IFileFilter) filter).Filter("_TestData/abc/Foo.txt")
);
}
}
}

0 comments on commit a590844

Please sign in to comment.