1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

fix tests

This commit is contained in:
Charlie Somerville 2018-05-23 15:38:47 -07:00
parent ab76b1a04d
commit 71e389ef71
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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