mirror of
https://github.com/chrisdone-archive/duet.git
synced 2024-10-05 21:57:49 +03:00
Add another test suite item
This commit is contained in:
parent
0a45439bbf
commit
3618877a30
71
test/Spec.hs
71
test/Spec.hs
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user