Add another test suite item

This commit is contained in:
Chris Done 2019-11-15 15:54:47 +01:00
parent 0a45439bbf
commit 3618877a30

View File

@ -32,25 +32,58 @@ spec :: SpecWith ()
spec =
describe
"Compilation"
(it
"Basic compile"
(shouldBe
(first
(const ())
(runNoLoggingT
((evalSupplyT
(do decls <- parseText "test" "main = 1"
(binds, ctx) <- createContext decls
things <-
execWriterT
(runStepper
100
ctx
(fmap (fmap typeSignatureA) binds)
"main")
pure things)
[1 ..]))))
(Right [LiteralExpression () (IntegerLiteral 1)])))
(do it
"Basic compile and run constant"
(shouldBe
(first
(const ())
(runNoLoggingT
((evalSupplyT
(do decls <- parseText "test" "main = 1"
(binds, ctx) <- createContext decls
things <-
execWriterT
(runStepper
100
ctx
(fmap (fmap typeSignatureA) binds)
"main")
pure things)
[1 ..]))))
(Right [LiteralExpression () (IntegerLiteral 1)]))
it
"Basic compile and run constant lambda"
(shouldBe
(first
(const ())
(runNoLoggingT
((evalSupplyT
(do decls <- parseText "test" "main = (\\x -> x) 1"
(binds, ctx) <- createContext decls
things <-
execWriterT
(runStepper
100
ctx
(fmap (fmap typeSignatureA) binds)
"main")
pure things)
[1 ..]))))
(Right
[ ApplicationExpression
()
(LambdaExpression
()
(Alternative
{ alternativeLabel = ()
, alternativePatterns =
[VariablePattern () (ValueName 42 "x")]
, alternativeExpression =
VariableExpression () (ValueName 42 "x")
}))
(LiteralExpression () (IntegerLiteral 1))
, LiteralExpression () (IntegerLiteral 1)
])))
-- | Create a context of all renamed, checked and resolved code.
createContext