2022-04-05 20:57:21 +03:00
|
|
|
module Base
|
|
|
|
( module Test.Tasty,
|
|
|
|
module Test.Tasty.HUnit,
|
|
|
|
module MiniJuvix.Prelude,
|
|
|
|
module Base,
|
|
|
|
)
|
|
|
|
where
|
2022-02-15 16:12:53 +03:00
|
|
|
|
2022-04-05 20:57:21 +03:00
|
|
|
import MiniJuvix.Prelude
|
2022-02-15 16:12:53 +03:00
|
|
|
import Test.Tasty
|
|
|
|
import Test.Tasty.HUnit
|
|
|
|
|
2022-04-05 20:57:21 +03:00
|
|
|
data AssertionDescr
|
|
|
|
= Single Assertion
|
2022-02-18 15:01:42 +03:00
|
|
|
| Steps ((String -> IO ()) -> Assertion)
|
|
|
|
|
2022-04-05 20:57:21 +03:00
|
|
|
data TestDescr = TestDescr
|
2022-04-07 19:10:53 +03:00
|
|
|
{ _testName :: String,
|
|
|
|
_testRoot :: FilePath,
|
2022-04-05 20:57:21 +03:00
|
|
|
-- | relative to root
|
2022-04-07 19:10:53 +03:00
|
|
|
_testAssertion :: AssertionDescr
|
2022-02-15 16:12:53 +03:00
|
|
|
}
|
|
|
|
|
2022-04-07 19:10:53 +03:00
|
|
|
makeLenses ''TestDescr
|
|
|
|
|
2022-02-15 16:12:53 +03:00
|
|
|
mkTest :: TestDescr -> TestTree
|
2022-04-07 19:10:53 +03:00
|
|
|
mkTest TestDescr {..} = case _testAssertion of
|
|
|
|
Single assertion -> testCase _testName $ withCurrentDirectory _testRoot assertion
|
|
|
|
Steps steps -> testCaseSteps _testName (withCurrentDirectory _testRoot . steps)
|