Skip to content

Commit

Permalink
Merge pull request #49 from forki/runTestRefactor
Browse files Browse the repository at this point in the history
Create a new function runTestsWithArgs
  • Loading branch information
Henrik Feldt authored Jan 4, 2017
2 parents 04c2984 + 8bd31db commit 6fd15ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ BenchmarkDotNet.Artifacts/
/.fake/
/.vs/
build/
*.orig
21 changes: 14 additions & 7 deletions Expecto/Expecto.fs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,8 @@ 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
Expand All @@ -898,14 +899,20 @@ module Tests =
else
1

/// Runs tests in this assembly with supplied command-line options.
/// Runs all given tests with the 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
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
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

0 comments on commit 6fd15ac

Please sign in to comment.