Rewrite #1

Open
svenvanheugten wants to merge 23 commits from mutannot-rewrite into main
2 changed files with 15 additions and 5 deletions
Showing only changes of commit 294b2f85a9 - Show all commits

View file

@ -11,6 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Argu" Version="6.2.5" />
<PackageReference Include="Fli" Version="1.1000.0" /> <PackageReference Include="Fli" Version="1.1000.0" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="9.0.1" /> <PackageReference Include="System.Reflection.MetadataLoadContext" Version="9.0.1" />
</ItemGroup> </ItemGroup>

View file

@ -3,6 +3,7 @@ open System.IO
open System.Reflection open System.Reflection
open System.Runtime.InteropServices open System.Runtime.InteropServices
open Fli open Fli
open Argu
type MutationCase = { TestName: string; Patch: string } type MutationCase = { TestName: string; Patch: string }
@ -118,18 +119,26 @@ let getMutationCases projectPath =
| _ -> None)) | _ -> None))
|> Seq.toList |> Seq.toList
type Arguments =
| [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string
interface IArgParserTemplate with
member s.Usage =
match s with
| ProjectPath _ -> "path/to/project.csproj|fsproj"
[<EntryPoint>] [<EntryPoint>]
let main argv = let main argv =
if argv.Length <> 1 then let parsedArguments =
eprintf "Usage: mutannot <path/to/project.csproj|fsproj>\n" ArgumentParser.Create<Arguments>(programName = "mutannot")
exit 1 |> _.ParseCommandLine(argv)
let projectPath = parsedArguments.GetResult ProjectPath
ensureCleanWorkingDirectory () ensureCleanWorkingDirectory ()
AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> restore ()) AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> restore ())
let projectPath = argv[0]
for index, mutationCase in getMutationCases projectPath |> Seq.indexed do for index, mutationCase in getMutationCases projectPath |> Seq.indexed do
Console.ForegroundColor <- ConsoleColor.Green Console.ForegroundColor <- ConsoleColor.Green
printf $"MUTATION {index + 1}\n" printf $"MUTATION {index + 1}\n"