@@ -19,11 +19,31 @@ tcaseW width name ast =
|
||||
(pure $ Sut.printDatumW width ast)
|
||||
id
|
||||
|
||||
thinWide name x = testGroup name
|
||||
[ tcase (name <> "-wide") x
|
||||
, tcaseW 4 (name <> "-thin") x
|
||||
]
|
||||
|
||||
datumBegin xs = S.indentWith (S.NSpecial 0) . S.List $
|
||||
(S.adorn S.SynBuiltin . S.Symbol $ "begin") : xs
|
||||
|
||||
datumLambda formals body =
|
||||
S.indentWith (S.NSpecial 1) . S.List $
|
||||
(S.adorn S.SynBuiltin . S.Symbol $ "lambda") : formals : body
|
||||
|
||||
test_print = testGroup "sexp pretty printer" $
|
||||
[ tcase "null" $ S.List []
|
||||
, let x = S.List [ S.Symbol s | s <- ["가","나","다","라"] ]
|
||||
in testGroup "simple list"
|
||||
[ tcase "flat" x
|
||||
, tcaseW 4 "long" x
|
||||
]
|
||||
, thinWide "simple-list" $
|
||||
S.List [ S.Symbol s | s <- ["가","나","다","라"] ]
|
||||
, thinWide "begin-nonempty" $
|
||||
S.indentWith (S.NSpecial 0) $
|
||||
datumBegin [ S.Symbol "책을"
|
||||
, S.Symbol "더"
|
||||
, S.Symbol "먹으세요~!"
|
||||
]
|
||||
, thinWide "lambda" $
|
||||
datumLambda (S.List [S.Symbol "어간", S.Symbol "어미"])
|
||||
[ S.List [S.Symbol "display", S.Symbol "꾸깃"] ]
|
||||
, tcase "rainbow" $
|
||||
S.List [S.List [S.List [S.List [S.List []]]]]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user