Rewrite #1
1 changed files with 22 additions and 12 deletions
|
|
@ -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,25 +156,32 @@ let main argv =
|
||||||
Console.ResetColor()
|
Console.ResetColor()
|
||||||
printf "%s\n" mutationCase.Patch
|
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
|
if not validateOnly then
|
||||||
| 0 ->
|
Console.ForegroundColor <- ConsoleColor.Magenta
|
||||||
Console.ForegroundColor <- ConsoleColor.Red
|
printf "Output:\n"
|
||||||
eprintf "ERROR: Expected tested to fail, but it succeeded\n"
|
|
||||||
Console.ResetColor()
|
Console.ResetColor()
|
||||||
exit 3
|
|
||||||
| _ ->
|
match runTest projectPath mutationCase.TestName with
|
||||||
Console.ForegroundColor <- ConsoleColor.Green
|
| 0 ->
|
||||||
printf "✓ Mutant killed\n\n"
|
Console.ForegroundColor <- ConsoleColor.Red
|
||||||
|
eprintf "ERROR: Expected tested to fail, but it succeeded\n"
|
||||||
|
Console.ResetColor()
|
||||||
|
exit 3
|
||||||
|
| _ ->
|
||||||
|
Console.ForegroundColor <- ConsoleColor.Green
|
||||||
|
printf "✓ Mutant killed\n\n"
|
||||||
|
|
||||||
restore ()
|
restore ()
|
||||||
|
|
||||||
Console.ForegroundColor <- ConsoleColor.Green
|
Console.ForegroundColor <- ConsoleColor.Green
|
||||||
printf "Success: All mutants killed\n"
|
|
||||||
|
if validateOnly then
|
||||||
|
printf "Success: All mutantions valid\n"
|
||||||
|
else
|
||||||
|
printf "Success: All mutants killed\n"
|
||||||
|
|
||||||
Console.ResetColor()
|
Console.ResetColor()
|
||||||
|
|
||||||
0
|
0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue