module Polysemy.Test (
module Polysemy.Test.Data.Test,
tempFileLines,
fixtureLines,
interpretTest,
interpretTestInSubdir,
runTestAuto,
runTest,
runTestInSubdir,
module Polysemy.Test.Data.Hedgehog,
interpretHedgehog,
UnitTest,
unitTest,
) where
import qualified Data.Text as Text
import Hedgehog (TestT, property, test, withTests)
import Path (File, Path, Rel)
import Test.Tasty (TestName, TestTree)
import Test.Tasty.Hedgehog (testProperty)
import Polysemy.Test.Data.Hedgehog (Hedgehog, assert, assertEqual, assertRight, evalEither, liftH, (===))
import Polysemy.Test.Data.Test (Test, fixture, fixturePath, tempDir, tempFile, tempFileContent, testDir)
import Polysemy.Test.Hedgehog (interpretHedgehog)
import Polysemy.Test.Run (interpretTest, interpretTestInSubdir, runTest, runTestAuto, runTestInSubdir)
type UnitTest = TestT IO ()
unitTest :: TestName -> UnitTest -> TestTree
unitTest :: TestName -> UnitTest -> TestTree
unitTest TestName
desc =
TestName -> Property -> TestTree
testProperty TestName
desc (Property -> TestTree)
-> (UnitTest -> Property) -> UnitTest -> TestTree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TestLimit -> Property -> Property
withTests TestLimit
1 (Property -> Property)
-> (UnitTest -> Property) -> UnitTest -> Property
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HasCallStack => PropertyT IO () -> Property
PropertyT IO () -> Property
property (PropertyT IO () -> Property)
-> (UnitTest -> PropertyT IO ()) -> UnitTest -> Property
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitTest -> PropertyT IO ()
forall (m :: * -> *) a. Monad m => TestT m a -> PropertyT m a
test
fixtureLines ::
∀ r .
Member Test r =>
Path Rel File ->
Sem r [Text]
fixtureLines :: Path Rel File -> Sem r [Text]
fixtureLines =
(Text -> [Text]) -> Sem r Text -> Sem r [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> [Text]
Text.lines (Sem r Text -> Sem r [Text])
-> (Path Rel File -> Sem r Text) -> Path Rel File -> Sem r [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Rel File -> Sem r Text
forall (r :: [(* -> *) -> * -> *]).
Member Test r =>
Path Rel File -> Sem r Text
fixture
tempFileLines ::
∀ r .
Member Test r =>
Path Rel File ->
Sem r [Text]
tempFileLines :: Path Rel File -> Sem r [Text]
tempFileLines =
(Text -> [Text]) -> Sem r Text -> Sem r [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> [Text]
Text.lines (Sem r Text -> Sem r [Text])
-> (Path Rel File -> Sem r Text) -> Path Rel File -> Sem r [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path Rel File -> Sem r Text
forall (r :: [(* -> *) -> * -> *]).
Member Test r =>
Path Rel File -> Sem r Text
tempFileContent