Allow for each test type to specify its own Tasty options

This commit is contained in:
Michael Walker 2018-02-14 22:38:56 +00:00
parent 827317d970
commit a5b478b74c
4 changed files with 27 additions and 2 deletions

View File

@ -1,6 +1,7 @@
module Main where
import qualified Test.Tasty as T
import qualified Test.Tasty.Options as T
import qualified Test.Tasty.QuickCheck as T
import qualified Examples as E
@ -8,7 +9,10 @@ import qualified Integration as I
import qualified Unit as U
main :: IO ()
main = T.defaultMain $ T.adjustOption reduceQCTests tests
main =
let ingredients = T.includingOptions options : T.defaultIngredients
runner = T.defaultMainWithIngredients ingredients
in runner (T.adjustOption reduceQCTests tests)
tests :: T.TestTree
tests = T.testGroup "Tests"
@ -17,6 +21,9 @@ tests = T.testGroup "Tests"
, T.testGroup "Examples" E.tests
]
options :: [T.OptionDescription]
options = U.options ++ I.options ++ E.options
-- | Reduce the default number of quickcheck runs.
reduceQCTests :: T.QuickCheckTests -> T.QuickCheckTests
reduceQCTests (T.QuickCheckTests n) = T.QuickCheckTests (min 25 n)

View File

@ -1,5 +1,7 @@
module Examples where
import Test.Tasty.Options (OptionDescription)
import qualified Examples.AutoUpdate as A
import qualified Examples.ClassLaws as C
import qualified Examples.Logger as L
@ -19,3 +21,7 @@ tests =
, testGroup "Philosophers" P.tests
, testGroup "SearchParty" S.tests
]
-- | Tasty options
options :: [OptionDescription]
options = []

View File

@ -1,5 +1,7 @@
module Integration where
import Test.Tasty.Options (OptionDescription)
import qualified Integration.Async as A
import qualified Integration.Discard as D
import qualified Integration.Litmus as L
@ -21,3 +23,7 @@ tests =
, testGroup "Regressions" G.tests
, testGroup "SingleThreaded" S.tests
]
-- | Tasty options
options :: [OptionDescription]
options = []

View File

@ -1,6 +1,8 @@
module Unit where
import qualified Unit.Properties as P
import Test.Tasty.Options (OptionDescription)
import qualified Unit.Properties as P
import Common
@ -9,3 +11,7 @@ tests :: [TestTree]
tests =
[ testGroup "Properties" P.tests
]
-- | Tasty options
options :: [OptionDescription]
options = []