Rewrite #1

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

View file

@ -121,7 +121,7 @@ let getMutationCases projectPath =
[<EntryPoint>] [<EntryPoint>]
let main argv = let main argv =
if argv.Length <> 1 then if argv.Length <> 1 then
eprintfn "Usage: mutannot <path/to/project.csproj|fsproj>" eprintf "Usage: mutannot <path/to/project.csproj|fsproj>\n"
exit 1 exit 1
ensureCleanWorkingDirectory () ensureCleanWorkingDirectory ()
@ -130,16 +130,39 @@ let main argv =
let projectPath = argv[0] let projectPath = argv[0]
for mutationCase in getMutationCases projectPath do for index, mutationCase in getMutationCases projectPath |> Seq.indexed do
printfn "MUTATION\n\n%s" <| mutationCase.Patch Console.ForegroundColor <- ConsoleColor.Green
printf $"MUTATION {index + 1}\n"
Console.ForegroundColor <- ConsoleColor.Magenta
printf "Test:\n"
Console.ResetColor()
printf "%s\n\n" mutationCase.TestName
Console.ForegroundColor <- ConsoleColor.Magenta
printf "Patch:\n"
Console.ResetColor()
printf "%s\n" mutationCase.Patch
Console.ForegroundColor <- ConsoleColor.Magenta
printf "Output:\n"
Console.ResetColor()
applyPatch mutationCase.Patch applyPatch mutationCase.Patch
match runTest projectPath mutationCase.TestName with match runTest projectPath mutationCase.TestName with
| 0 -> | 0 ->
eprintfn "Expected tested to fail, but it succeeded" Console.ForegroundColor <- ConsoleColor.Red
eprintf "ERROR: Expected tested to fail, but it succeeded\n"
Console.ResetColor()
exit 3 exit 3
| _ -> printfn "Mutant killed\n" | _ ->
Console.ForegroundColor <- ConsoleColor.Green
printf "✓ Mutant killed\n\n"
restore () restore ()
Console.ForegroundColor <- ConsoleColor.Green
printf "Success: All mutants killed\n"
Console.ResetColor()
0 0