From 71e389ef717cf57208f6d5cc6f22195d5fe29fc0 Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Wed, 23 May 2018 15:38:47 -0700 Subject: [PATCH] fix tests --- src/Semantic/Util.hs | 5 ++++- test/Control/Abstract/Evaluator/Spec.hs | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index b9500dcb8..3c670580b 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -88,7 +88,10 @@ pythonPrelude = Just $ File (TypeLevel.symbolVal (Proxy :: Proxy (PreludePath Py javaScriptPrelude = Just $ File (TypeLevel.symbolVal (Proxy :: Proxy (PreludePath TypeScript.Term))) (Just Language.JavaScript) -- Evaluate a project, starting at a single entrypoint. -evaluateProject parser lang prelude path = evaluatePackageWith id withTermSpans . fmap quieterm <$> runTask (readProject Nothing path lang [] >>= parsePackage parser prelude) +evaluateProject parser lang prelude path = do + x <- evaluatePackageWith id withTermSpans . fmap quieterm <$> runTask (readProject Nothing path lang [] >>= parsePackage parser prelude) + pure (TermEvaluator (runAllocator (runTermEvaluator x >>= mapM deref))) + evaluateProjectWithCaching parser lang prelude path = evaluatePackageWith convergingModules (withTermSpans . cachingTerms) . fmap quieterm <$> runTask (readProject Nothing path lang [] >>= parsePackage parser prelude) diff --git a/test/Control/Abstract/Evaluator/Spec.hs b/test/Control/Abstract/Evaluator/Spec.hs index 394c3ca1f..1d7b274c4 100644 --- a/test/Control/Abstract/Evaluator/Spec.hs +++ b/test/Control/Abstract/Evaluator/Spec.hs @@ -19,13 +19,13 @@ import SpecHelpers hiding (reassociate) spec :: Spec spec = parallel $ do it "constructs integers" $ do - (expected, _) <- evaluate (integer 123) + (expected, _) <- evaluate (box =<< integer 123) expected `shouldBe` Right (injValue (Value.Integer (Number.Integer 123))) it "calls functions" $ do (expected, _) <- evaluate $ do identity <- closure [name "x"] lowerBound (variable (name "x")) - call identity [integer 123] + call identity [box =<< integer 123] expected `shouldBe` Right (injValue (Value.Integer (Number.Integer 123))) evaluate @@ -38,6 +38,7 @@ evaluate . runEnvironmentError . runAddressError . runAllocator + . (>>= deref) . runReturn . runLoopControl . fmap fst