From ae246d3f36373fd534e576f5f02ce8065f3b6f2a Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Tue, 12 May 2026 16:14:35 +0200 Subject: [PATCH] Improve console output a lot --- Mutannot/Program.fs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Mutannot/Program.fs b/Mutannot/Program.fs index 872fc25..15ba0f2 100644 --- a/Mutannot/Program.fs +++ b/Mutannot/Program.fs @@ -121,7 +121,7 @@ let getMutationCases projectPath = [] let main argv = if argv.Length <> 1 then - eprintfn "Usage: mutannot " + eprintf "Usage: mutannot \n" exit 1 ensureCleanWorkingDirectory () @@ -130,16 +130,39 @@ let main argv = let projectPath = argv[0] - for mutationCase in getMutationCases projectPath do - printfn "MUTATION\n\n%s" <| mutationCase.Patch + for index, mutationCase in getMutationCases projectPath |> Seq.indexed do + 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 match runTest projectPath mutationCase.TestName with | 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 - | _ -> printfn "Mutant killed\n" + | _ -> + Console.ForegroundColor <- ConsoleColor.Green + printf "✓ Mutant killed\n\n" restore () + Console.ForegroundColor <- ConsoleColor.Green + printf "Success: All mutants killed\n" + Console.ResetColor() + 0