1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 11:02:26 +03:00

Correct the EvaluatorSpec.

This commit is contained in:
Rob Rix 2018-12-18 11:19:47 -05:00
parent 6bce2b117f
commit f37b417fd9

View File

@ -26,7 +26,7 @@ import System.IO.Unsafe (unsafePerformIO)
spec :: Spec
spec = parallel $ do
it "constructs integers" $ do
(_, (_, (_, expected))) <- evaluate (pure (integer 123))
(_, (_, (_, expected))) <- evaluate (integer 123)
expected `shouldBe` Right (Value.Integer (Number.Integer 123))
it "calls functions" $ do
@ -40,9 +40,9 @@ spec = parallel $ do
declare (Declaration x) Default emptySpan Nothing
identity <- function "identity" [ x ]
(SpecEff (Heap.lookupDeclaration (ScopeGraph.Declaration (SpecHelpers.name "x")) >>= deref)) associatedScope
val <- pure (integer 123)
val <- integer 123
call identity [val]
expected `shouldBe` Right (integer 123)
expected `shouldBe` Right (Value.Integer (Number.Integer 123))
evaluate
= runM
@ -73,6 +73,7 @@ evaluate
. runAllocator
. runReturn
. runLoopControl
. runNumeric
. runBoolean
. runFunction runSpecEff
$ action
@ -85,6 +86,7 @@ type Val = Value SpecEff Precise
newtype SpecEff = SpecEff
{ runSpecEff :: Evaluator SpecEff Precise Val (FunctionC SpecEff Precise Val
(Eff (BooleanC Val
(Eff (NumericC Val
(Eff (ErrorC (LoopControl Val)
(Eff (ErrorC (Return Val)
(Eff (AllocatorC Precise
@ -105,7 +107,7 @@ newtype SpecEff = SpecEff
(Eff (StateC (Heap Precise Precise Val)
(Eff (StateC (ScopeGraph Precise)
(Eff (TraceByIgnoringC
(Eff (LiftC IO)))))))))))))))))))))))))))))))))))))))))))))
(Eff (LiftC IO)))))))))))))))))))))))))))))))))))))))))))))))
Val
}