{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Test.Syd.Def.AroundAll where
import Control.Monad.Writer.Strict
import Test.QuickCheck.IO ()
import Test.Syd.Def.TestDefM
import Test.Syd.HList
import Test.Syd.SpecDef
beforeAll_ ::
IO () ->
TestDefM outers inner result ->
TestDefM outers inner result
beforeAll_ :: forall (outers :: [*]) inner result.
IO ()
-> TestDefM outers inner result -> TestDefM outers inner result
beforeAll_ IO ()
action = (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result)
-> (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result
-> TestDefM outers inner result
forall a b. (a -> b) -> a -> b
$ \TestForest outers inner
forest -> IO () -> TestForest outers inner -> TestTree outers inner
forall (outers :: [*]) inner extra.
IO ()
-> SpecDefForest outers inner extra
-> SpecDefTree outers inner extra
DefSetupNode IO ()
action TestForest outers inner
forest
beforeAll ::
IO outer ->
TestDefM (outer ': otherOuters) inner result ->
TestDefM otherOuters inner result
beforeAll :: forall outer (otherOuters :: [*]) inner result.
IO outer
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
beforeAll IO outer
action = (TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result)
-> (TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
forall a b. (a -> b) -> a -> b
$ \TestForest (outer : otherOuters) inner
forest -> IO outer
-> TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner
forall outer (outers :: [*]) inner extra.
IO outer
-> SpecDefForest (outer : outers) inner extra
-> SpecDefTree outers inner extra
DefBeforeAllNode IO outer
action TestForest (outer : otherOuters) inner
forest
beforeAllWith ::
(previousOuter -> IO newOuter) ->
TestDefM (newOuter ': previousOuter ': otherOuters) inner result ->
TestDefM (previousOuter ': otherOuters) inner result
beforeAllWith :: forall previousOuter newOuter (otherOuters :: [*]) inner result.
(previousOuter -> IO newOuter)
-> TestDefM (newOuter : previousOuter : otherOuters) inner result
-> TestDefM (previousOuter : otherOuters) inner result
beforeAllWith previousOuter -> IO newOuter
action = (TestForest (newOuter : previousOuter : otherOuters) inner
-> TestTree (previousOuter : otherOuters) inner)
-> TestDefM (newOuter : previousOuter : otherOuters) inner result
-> TestDefM (previousOuter : otherOuters) inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest (newOuter : previousOuter : otherOuters) inner
-> TestTree (previousOuter : otherOuters) inner)
-> TestDefM (newOuter : previousOuter : otherOuters) inner result
-> TestDefM (previousOuter : otherOuters) inner result)
-> (TestForest (newOuter : previousOuter : otherOuters) inner
-> TestTree (previousOuter : otherOuters) inner)
-> TestDefM (newOuter : previousOuter : otherOuters) inner result
-> TestDefM (previousOuter : otherOuters) inner result
forall a b. (a -> b) -> a -> b
$ \TestForest (newOuter : previousOuter : otherOuters) inner
forest -> (previousOuter -> IO newOuter)
-> TestForest (newOuter : previousOuter : otherOuters) inner
-> TestTree (previousOuter : otherOuters) inner
forall oldOuter newOuter (otherOuters :: [*]) inner extra.
(oldOuter -> IO newOuter)
-> SpecDefForest (newOuter : oldOuter : otherOuters) inner extra
-> SpecDefTree (oldOuter : otherOuters) inner extra
DefBeforeAllWithNode previousOuter -> IO newOuter
action TestForest (newOuter : previousOuter : otherOuters) inner
forest
afterAll_ ::
IO () ->
TestDefM outers inner result ->
TestDefM outers inner result
afterAll_ :: forall (outers :: [*]) inner result.
IO ()
-> TestDefM outers inner result -> TestDefM outers inner result
afterAll_ IO ()
action = (HList outers -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result
forall (outers :: [*]) inner result.
(HList outers -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result
afterAll' ((HList outers -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result)
-> (HList outers -> IO ())
-> TestDefM outers inner result
-> TestDefM outers inner result
forall a b. (a -> b) -> a -> b
$ \HList outers
_ -> IO ()
action
afterAll ::
(outer -> IO ()) ->
TestDefM (outer ': otherOuters) inner result ->
TestDefM (outer ': otherOuters) inner result
afterAll :: forall outer (otherOuters :: [*]) inner result.
(outer -> IO ())
-> TestDefM (outer : otherOuters) inner result
-> TestDefM (outer : otherOuters) inner result
afterAll outer -> IO ()
func = (HList (outer : otherOuters) -> IO ())
-> TestDefM (outer : otherOuters) inner result
-> TestDefM (outer : otherOuters) inner result
forall (outers :: [*]) inner result.
(HList outers -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result
afterAll' ((HList (outer : otherOuters) -> IO ())
-> TestDefM (outer : otherOuters) inner result
-> TestDefM (outer : otherOuters) inner result)
-> (HList (outer : otherOuters) -> IO ())
-> TestDefM (outer : otherOuters) inner result
-> TestDefM (outer : otherOuters) inner result
forall a b. (a -> b) -> a -> b
$ \(HCons e
a HList l
_) -> outer -> IO ()
func outer
e
a
afterAll' ::
(HList outers -> IO ()) ->
TestDefM outers inner result ->
TestDefM outers inner result
afterAll' :: forall (outers :: [*]) inner result.
(HList outers -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result
afterAll' HList outers -> IO ()
func = (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result)
-> (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result
-> TestDefM outers inner result
forall a b. (a -> b) -> a -> b
$ \TestForest outers inner
forest -> (HList outers -> IO ())
-> TestForest outers inner -> TestTree outers inner
forall (outers :: [*]) inner extra.
(HList outers -> IO ())
-> SpecDefForest outers inner extra
-> SpecDefTree outers inner extra
DefAfterAllNode HList outers -> IO ()
func TestForest outers inner
forest
aroundAll_ ::
(IO () -> IO ()) ->
TestDefM outers inner result ->
TestDefM outers inner result
aroundAll_ :: forall (outers :: [*]) inner result.
(IO () -> IO ())
-> TestDefM outers inner result -> TestDefM outers inner result
aroundAll_ IO () -> IO ()
func = (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result -> TestDefM outers inner result)
-> (TestForest outers inner -> TestTree outers inner)
-> TestDefM outers inner result
-> TestDefM outers inner result
forall a b. (a -> b) -> a -> b
$ \TestForest outers inner
forest -> (IO () -> IO ())
-> TestForest outers inner -> TestTree outers inner
forall (outers :: [*]) inner extra.
(IO () -> IO ())
-> SpecDefForest outers inner extra
-> SpecDefTree outers inner extra
DefWrapNode IO () -> IO ()
func TestForest outers inner
forest
aroundAll ::
((outer -> IO ()) -> IO ()) ->
TestDefM (outer ': otherOuters) inner result ->
TestDefM otherOuters inner result
aroundAll :: forall outer (otherOuters :: [*]) inner result.
((outer -> IO ()) -> IO ())
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
aroundAll (outer -> IO ()) -> IO ()
func = (TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result)
-> (TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner)
-> TestDefM (outer : otherOuters) inner result
-> TestDefM otherOuters inner result
forall a b. (a -> b) -> a -> b
$ \TestForest (outer : otherOuters) inner
forest -> ((outer -> IO ()) -> IO ())
-> TestForest (outer : otherOuters) inner
-> TestTree otherOuters inner
forall outer (outers :: [*]) inner extra.
((outer -> IO ()) -> IO ())
-> SpecDefForest (outer : outers) inner extra
-> SpecDefTree outers inner extra
DefAroundAllNode (outer -> IO ()) -> IO ()
func TestForest (outer : otherOuters) inner
forest
aroundAllWith ::
forall newOuter oldOuter otherOuters inner result.
((newOuter -> IO ()) -> (oldOuter -> IO ())) ->
TestDefM (newOuter ': oldOuter ': otherOuters) inner result ->
TestDefM (oldOuter ': otherOuters) inner result
aroundAllWith :: forall newOuter oldOuter (otherOuters :: [*]) inner result.
((newOuter -> IO ()) -> oldOuter -> IO ())
-> TestDefM (newOuter : oldOuter : otherOuters) inner result
-> TestDefM (oldOuter : otherOuters) inner result
aroundAllWith (newOuter -> IO ()) -> oldOuter -> IO ()
func = (TestForest (newOuter : oldOuter : otherOuters) inner
-> TestTree (oldOuter : otherOuters) inner)
-> TestDefM (newOuter : oldOuter : otherOuters) inner result
-> TestDefM (oldOuter : otherOuters) inner result
forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest ((TestForest (newOuter : oldOuter : otherOuters) inner
-> TestTree (oldOuter : otherOuters) inner)
-> TestDefM (newOuter : oldOuter : otherOuters) inner result
-> TestDefM (oldOuter : otherOuters) inner result)
-> (TestForest (newOuter : oldOuter : otherOuters) inner
-> TestTree (oldOuter : otherOuters) inner)
-> TestDefM (newOuter : oldOuter : otherOuters) inner result
-> TestDefM (oldOuter : otherOuters) inner result
forall a b. (a -> b) -> a -> b
$ \TestForest (newOuter : oldOuter : otherOuters) inner
forest -> ((newOuter -> IO ()) -> oldOuter -> IO ())
-> TestForest (newOuter : oldOuter : otherOuters) inner
-> TestTree (oldOuter : otherOuters) inner
forall newOuter oldOuter (otherOuters :: [*]) inner extra.
((newOuter -> IO ()) -> oldOuter -> IO ())
-> SpecDefForest (newOuter : oldOuter : otherOuters) inner extra
-> SpecDefTree (oldOuter : otherOuters) inner extra
DefAroundAllWithNode (newOuter -> IO ()) -> oldOuter -> IO ()
func TestForest (newOuter : oldOuter : otherOuters) inner
forest
wrapForest ::
(TestForest outers1 inner1 -> TestTree outers2 inner2) ->
TestDefM outers1 inner1 result ->
TestDefM outers2 inner2 result
wrapForest :: forall (outers1 :: [*]) inner1 (outers2 :: [*]) inner2 result.
(TestForest outers1 inner1 -> TestTree outers2 inner2)
-> TestDefM outers1 inner1 result -> TestDefM outers2 inner2 result
wrapForest TestForest outers1 inner1 -> TestTree outers2 inner2
func (TestDefM WriterT (TestForest outers1 inner1) (ReaderT TestDefEnv IO) result
rwst) = WriterT (TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
-> TestDefM outers2 inner2 result
forall (outers :: [*]) inner result.
WriterT (TestForest outers inner) (ReaderT TestDefEnv IO) result
-> TestDefM outers inner result
TestDefM (WriterT (TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
-> TestDefM outers2 inner2 result)
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
-> TestDefM outers2 inner2 result
forall a b. (a -> b) -> a -> b
$
((ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2))
-> WriterT
(TestForest outers1 inner1) (ReaderT TestDefEnv IO) result
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result)
-> WriterT
(TestForest outers1 inner1) (ReaderT TestDefEnv IO) result
-> (ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2))
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2))
-> WriterT
(TestForest outers1 inner1) (ReaderT TestDefEnv IO) result
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
forall (m :: * -> *) a w (n :: * -> *) b w'.
(m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
mapWriterT WriterT (TestForest outers1 inner1) (ReaderT TestDefEnv IO) result
rwst ((ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2))
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result)
-> (ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2))
-> WriterT
(TestForest outers2 inner2) (ReaderT TestDefEnv IO) result
forall a b. (a -> b) -> a -> b
$ \ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
inner -> do
(result
res, TestForest outers1 inner1
forest) <- ReaderT TestDefEnv IO (result, TestForest outers1 inner1)
inner
let forest' :: TestForest outers2 inner2
forest' = [TestForest outers1 inner1 -> TestTree outers2 inner2
func TestForest outers1 inner1
forest]
(result, TestForest outers2 inner2)
-> ReaderT TestDefEnv IO (result, TestForest outers2 inner2)
forall a. a -> ReaderT TestDefEnv IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (result
res, TestForest outers2 inner2
forest')