2 | import Language.Reflection
3 | import Language.Reflection.TTImp
6 | %language ElabReflection
10 | describe : String -> Spec a () -> Spec a ()
11 | describe label body = MkSpec [< Describe label (getSpecTrees body)] ()
15 | context : String -> Spec a () -> Spec a ()
20 | it : String -> TestResult () -> Spec a ()
21 | it label result = MkSpec [< It label Nothing (\_ => pure result)] ()
25 | itIO : String -> IO (TestResult ()) -> Spec a ()
26 | itIO label action = MkSpec [< It label Nothing (\_ => action)] ()
30 | itWith : String -> (a -> TestResult ()) -> Spec a ()
31 | itWith label f = MkSpec [< It label Nothing (\res => pure (f res))] ()
35 | itIOWith : String -> (a -> IO (TestResult ())) -> Spec a ()
36 | itIOWith label f = MkSpec [< It label Nothing f] ()
43 | itLoc : TTImp -> String -> TestResult () -> Elab (Spec a ())
44 | itLoc t label result = do
45 | let loc = fcToSrcLoc (getFC t)
46 | pure $
MkSpec [< It label (Just loc) (\_ => pure result)] ()
52 | itIOLoc : TTImp -> String -> IO (TestResult ()) -> Elab (Spec a ())
53 | itIOLoc t label action = do
54 | let loc = fcToSrcLoc (getFC t)
55 | pure $
MkSpec [< It label (Just loc) (\_ => action)] ()
59 | xit : String -> TestResult () -> Spec a ()
60 | xit label _ = MkSpec [< Pending label Nothing] ()
64 | xdescribe : String -> Spec a () -> Spec a ()
65 | xdescribe label _ = MkSpec [< Pending label Nothing] ()
69 | xcontext : String -> Spec a () -> Spec a ()
70 | xcontext = xdescribe
74 | fit : String -> TestResult () -> Spec a ()
75 | fit label result = MkSpec [< Focused (It label Nothing (\_ => pure result))] ()
79 | fdescribe : String -> Spec a () -> Spec a ()
80 | fdescribe label body = MkSpec [< Focused (Describe label (getSpecTrees body))] ()
84 | fcontext : String -> Spec a () -> Spec a ()
85 | fcontext = fdescribe