Rewrite #1

Open
svenvanheugten wants to merge 23 commits from mutannot-rewrite into main
Showing only changes of commit 500b3f0d8c - Show all commits

View file

@ -121,11 +121,13 @@ let getMutationCases projectPath =
type Arguments = type Arguments =
| [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string | [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string
| ValidateOnly
interface IArgParserTemplate with interface IArgParserTemplate with
member s.Usage = member s.Usage =
match s with match s with
| ProjectPath _ -> "path/to/project.csproj|fsproj" | ProjectPath _ -> "path/to/project.csproj|fsproj"
| ValidateOnly -> "check if the patches apply, but don't run the mutations"
[<EntryPoint>] [<EntryPoint>]
let main argv = let main argv =
@ -134,6 +136,7 @@ let main argv =
|> _.ParseCommandLine(argv) |> _.ParseCommandLine(argv)
let projectPath = parsedArguments.GetResult ProjectPath let projectPath = parsedArguments.GetResult ProjectPath
let validateOnly = parsedArguments.Contains ValidateOnly
ensureCleanWorkingDirectory () ensureCleanWorkingDirectory ()
@ -153,10 +156,12 @@ let main argv =
Console.ResetColor() Console.ResetColor()
printf "%s\n" mutationCase.Patch printf "%s\n" mutationCase.Patch
applyPatch mutationCase.Patch
if not validateOnly then
Console.ForegroundColor <- ConsoleColor.Magenta Console.ForegroundColor <- ConsoleColor.Magenta
printf "Output:\n" printf "Output:\n"
Console.ResetColor() Console.ResetColor()
applyPatch mutationCase.Patch
match runTest projectPath mutationCase.TestName with match runTest projectPath mutationCase.TestName with
| 0 -> | 0 ->
@ -171,7 +176,12 @@ let main argv =
restore () restore ()
Console.ForegroundColor <- ConsoleColor.Green Console.ForegroundColor <- ConsoleColor.Green
if validateOnly then
printf "Success: All mutantions valid\n"
else
printf "Success: All mutants killed\n" printf "Success: All mutants killed\n"
Console.ResetColor() Console.ResetColor()
0 0