-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUtil.purs
45 lines (40 loc) · 939 Bytes
/
Util.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module Test.Util where
import Prelude
import Control.Monad.Writer (Writer)
import Data.List (List)
import Tecton.Internal
( class ToVal
, Declaration'
, Statement
, compact
, renderInline'
, renderSheet
, runVal
, val
)
import Test.Spec (Spec, it)
import Test.Spec.Assertions (shouldEqual)
isRenderedFromInline
:: forall ps
. String
-> Writer (List Declaration') ps
-> Spec Unit
isRenderedFromInline expected given =
it ("renders " <> expected) $
renderInline' compact given `shouldEqual` expected
isRenderedFromSheet
:: String
-> Writer (List Statement) Unit
-> Spec Unit
isRenderedFromSheet expected given =
it ("renders " <> expected) $
renderSheet compact given `shouldEqual` expected
isRenderedFromVal
:: forall a
. ToVal a
=> String
-> a
-> Spec Unit
isRenderedFromVal expected given =
it ("renders " <> expected) $
runVal compact (val given) `shouldEqual` expected