From 26a45f25355b081dbf731d7f94c8a7936fc2da1f Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 4 Jan 2017 10:04:11 +0100 Subject: [PATCH 1/2] Create a new function runTestsWithArgs - closes #48 --- Expecto/Expecto.fs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Expecto/Expecto.fs b/Expecto/Expecto.fs index 3a93f598..68d76726 100644 --- a/Expecto/Expecto.fs +++ b/Expecto/Expecto.fs @@ -887,7 +887,9 @@ module Tests = |> Test.toTestCodeList |> Seq.iter (fun t -> printfn "%s" t.name) - /// Runs tests with supplied options. Returns 0 if all tests passed, otherwise 1. + /// Runs tests with the supplied options. + + /// Returns 0 if all tests passed, otherwise 1 let runTests config (tests:Test) = let run = if config.parallel then runParallel else run Global.initialiseIfDefault @@ -898,14 +900,18 @@ module Tests = else 1 - /// Runs tests in this assembly with supplied command-line options. - /// Returns 0 if all tests passed, otherwise 1 - let runTestsInAssembly config args = - let tests = testFromThisAssembly () |> Option.orDefault (TestList ([], Normal)) - let config, isList = args |> ExpectoConfig.fillFromArgs config - let tests = tests |> config.filter + /// Runs all given tests with the supplied command-line options. Returns 0 if all tests passed, otherwise 1 + let runTestsWithArgs config args tests = + let config, isList = ExpectoConfig.fillFromArgs config args + let tests = config.filter tests if isList then listTests tests 0 else - runTests config tests \ No newline at end of file + runTests config tests + + /// Runs tests in this assembly with the supplied command-line options. Returns 0 if all tests passed, otherwise 1 + let runTestsInAssembly config args = + testFromThisAssembly () + |> Option.orDefault (TestList ([], Normal)) + |> runTestsWithArgs config args From 8bd31dbbcde11e3c8f11935794f44608f5d2d75c Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 4 Jan 2017 10:14:54 +0100 Subject: [PATCH 2/2] Cleanup --- .gitignore | 1 + Expecto/Expecto.fs | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 19bf9fee..51e83fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ BenchmarkDotNet.Artifacts/ /.fake/ /.vs/ build/ +*.orig diff --git a/Expecto/Expecto.fs b/Expecto/Expecto.fs index 68d76726..e27bf6de 100644 --- a/Expecto/Expecto.fs +++ b/Expecto/Expecto.fs @@ -888,7 +888,6 @@ module Tests = |> Seq.iter (fun t -> printfn "%s" t.name) /// Runs tests with the supplied options. - /// Returns 0 if all tests passed, otherwise 1 let runTests config (tests:Test) = let run = if config.parallel then runParallel else run @@ -900,7 +899,8 @@ module Tests = else 1 - /// Runs all given tests with the supplied command-line options. Returns 0 if all tests passed, otherwise 1 + /// Runs all given tests with the supplied command-line options. + /// Returns 0 if all tests passed, otherwise 1 let runTestsWithArgs config args tests = let config, isList = ExpectoConfig.fillFromArgs config args let tests = config.filter tests @@ -910,8 +910,9 @@ module Tests = else runTests config tests - /// Runs tests in this assembly with the supplied command-line options. Returns 0 if all tests passed, otherwise 1 + /// Runs tests in this assembly with the supplied command-line options. + /// Returns 0 if all tests passed, otherwise 1 let runTestsInAssembly config args = - testFromThisAssembly () + testFromThisAssembly () |> Option.orDefault (TestList ([], Normal)) |> runTestsWithArgs config args