2 | import Language.Reflection
3 | import Language.Reflection.TTImp
6 | %language ElabReflection
10 | describe : String -> Spec m a () -> Spec m a ()
11 | describe label body = MkSpec [< Describe label (getSpecTrees body)] ()
15 | context : String -> Spec m a () -> Spec m a ()
23 | it : Hoist n m => String -> Lazy (TestResultT n ()) -> Spec m a ()
24 | it label body = MkSpec [< It label Nothing (\_ => runTestResultT (hoistChain body))] ()
28 | itWith : Hoist n m => String -> (a -> TestResultT n ()) -> Spec m a ()
29 | itWith label f = MkSpec [< It label Nothing (runTestResultT . hoistChain . f)] ()
36 | itLoc : Hoist n m => TTImp -> String -> Lazy (TestResultT n ()) -> Elab (Spec m a ())
37 | itLoc t label body = do
38 | let loc = fcToSrcLoc (getFC t)
39 | pure $
MkSpec [< It label (Just loc) (\_ => runTestResultT (hoistChain body))] ()
43 | xit : Hoist n m => String -> Lazy (TestResultT n ()) -> Spec m a ()
44 | xit label _ = MkSpec [< Pending label Nothing] ()
49 | pendTree : SpecTree m a -> List (SpecTree m a)
50 | pendTree (It label _ _) = [Pending label Nothing]
51 | pendTree (Describe label cs) = [Describe label (pendTrees cs)]
52 | pendTree (Pending label reason) = [Pending label reason]
53 | pendTree (Focused t) = pendTree t
54 | pendTree (WithCleanup _ cs) = pendTrees cs
56 | pendTrees : List (SpecTree m a) -> List (SpecTree m a)
58 | pendTrees (t :: ts) = pendTree t ++ pendTrees ts
63 | xdescribe : String -> Spec m a () -> Spec m a ()
64 | xdescribe label body = MkSpec [< Describe label (pendTrees (getSpecTrees body))] ()
68 | xcontext : String -> Spec m a () -> Spec m a ()
69 | xcontext = xdescribe
73 | fit : Hoist n m => String -> Lazy (TestResultT n ()) -> Spec m a ()
74 | fit label body = MkSpec [< Focused (It label Nothing (\_ => runTestResultT (hoistChain body)))] ()
78 | fdescribe : String -> Spec m a () -> Spec m a ()
79 | fdescribe label body = MkSpec [< Focused (Describe label (getSpecTrees body))] ()
83 | fcontext : String -> Spec m a () -> Spec m a ()
84 | fcontext = fdescribe
89 | focus : Spec m a () -> Spec m a ()
90 | focus body = MkSpec (Lin <>< map Focused (getSpecTrees body)) ()