diff --git a/src/Core/Internal/Filtering.cs b/src/Core/Internal/Filtering.cs index dfa1405..eade7fa 100644 --- a/src/Core/Internal/Filtering.cs +++ b/src/Core/Internal/Filtering.cs @@ -15,8 +15,10 @@ public static bool ShouldMutateProject(Project project, Config config) return true; } + var relativePath = RelativeFilePath(project.FilePath, config); + return config.ProjectFilters - .Any(f => Glob.Parse(f).IsMatch(project.Name)); + .Any(f => Glob.Parse(f).IsMatch(project.Name) || Glob.Parse(f).IsMatch(relativePath)); } public static bool ShouldMutateDocument(Document document, Config config) @@ -33,7 +35,7 @@ private static bool ShouldMutateAccordingToFilters(Document document, Config con return true; } - var relativePath = RelativeDocumentPath(document, config); + var relativePath = RelativeFilePath(document.FilePath, config); var matchesAnyFilter = config.SourceFileFilters .Any(f => Glob.Parse(f).IsMatch(relativePath)); @@ -48,16 +50,16 @@ private static bool ShouldMutateAccordingToLocallyModifiedList(Document document return true; } - var relativePath = RelativeDocumentPath(document, config); + var relativePath = RelativeFilePath(document.FilePath, config); return config.LocallyModifiedSourceFiles .Any(f => string.Equals(f, relativePath, StringComparison.InvariantCultureIgnoreCase)); } - private static string RelativeDocumentPath(Document document, Config config) + private static string RelativeFilePath(string filePath, Config config) { var baseDir = config.GetSolutionFolder(); - var relativePath = document.FilePath.Substring(baseDir.Length + 1); + var relativePath = filePath.Substring(baseDir.Length + 1); return relativePath; } } diff --git a/src/Tests/Core/Filtering/Projects_are_filtered.cs b/src/Tests/Core/Filtering/Projects_are_filtered.cs index 2fafe8c..4f16723 100644 --- a/src/Tests/Core/Filtering/Projects_are_filtered.cs +++ b/src/Tests/Core/Filtering/Projects_are_filtered.cs @@ -3,14 +3,16 @@ namespace Fettle.Tests.Core.Filtering { + [TestFixture("HasSurvivingMutants.MoreImplementation")] + [TestFixture(@"MoreImplementation\HasSurvivingMutants.MoreImplementation.csproj")] class Projects_are_filtered : Contexts.Default { - public Projects_are_filtered() + public Projects_are_filtered(string projectFilter) { Given_a_partially_tested_app_in_which_a_mutant_will_survive(); Given_source_file_filters(null); - Given_project_filters("HasSurvivingMutants.MoreImplementation"); + Given_project_filters(projectFilter); When_mutation_testing_the_app(); }