1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Use isJust where applicable

This commit is contained in:
Jan Hrček 2019-06-16 17:14:03 +02:00
parent 915937c4be
commit ade8e8b265
5 changed files with 39 additions and 39 deletions

View File

@ -14,19 +14,19 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"] (scopeGraph, (heap, res)) <- evaluate ["main.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"]
case ModuleTable.lookup "main.go" <$> res of case ModuleTable.lookup "main.go" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
SpecHelpers.lookupMembers "foo" Import scopeAndFrame heap scopeGraph `shouldBe` Just ["New"] SpecHelpers.lookupMembers "foo" Import scopeAndFrame heap scopeGraph `shouldBe` Just ["New"]
() <$ SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "Rab" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Rab" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "imports with aliases (and side effects only)" $ do it "imports with aliases (and side effects only)" $ do
(scopeGraph, (heap, res)) <- evaluate ["main1.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"] (scopeGraph, (heap, res)) <- evaluate ["main1.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"]
case ModuleTable.lookup "main1.go" <$> res of case ModuleTable.lookup "main1.go" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "f" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "f" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
-- (lookupDeclaration "f" heap >>= deNamespace heap) `shouldBe` Just ("f", ["New"]) -- (lookupDeclaration "f" heap >>= deNamespace heap) `shouldBe` Just ("f", ["New"])
other -> expectationFailure (show other) other -> expectationFailure (show other)

View File

@ -16,8 +16,8 @@ spec = parallel $ do
case ModuleTable.lookup "main.php" <$> res of case ModuleTable.lookup "main.php" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` Value.Unit value `shouldBe` Value.Unit
() <$ SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
xit "evaluates include_once and require_once" $ do xit "evaluates include_once and require_once" $ do
@ -25,16 +25,16 @@ spec = parallel $ do
case ModuleTable.lookup "main_once.php" <$> res of case ModuleTable.lookup "main_once.php" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` Value.Unit value `shouldBe` Value.Unit
() <$ SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
xit "evaluates namespaces" $ do xit "evaluates namespaces" $ do
(scopeGraph, (heap, res)) <- evaluate ["namespaces.php"] (scopeGraph, (heap, res)) <- evaluate ["namespaces.php"]
case ModuleTable.lookup "namespaces.php" <$> res of case ModuleTable.lookup "namespaces.php" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "NS1" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "NS1" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
undefined undefined
-- (derefQName heap ("NS1" :| []) env >>= deNamespace heap) `shouldBe` Just ("NS1", ["Sub1", "b", "c"]) -- (derefQName heap ("NS1" :| []) env >>= deNamespace heap) `shouldBe` Just ("NS1", ["Sub1", "b", "c"])

View File

@ -16,8 +16,8 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main.py", "a.py", "b/__init__.py", "b/c.py"] (scopeGraph, (heap, res)) <- evaluate ["main.py", "a.py", "b/__init__.py", "b/c.py"]
case ModuleTable.lookup "main.py" <$> res of case ModuleTable.lookup "main.py" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "a" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "a" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
fromJust (SpecHelpers.lookupMembers "a" Import scopeAndFrame heap scopeGraph) `shouldContain` [ "foo" ] fromJust (SpecHelpers.lookupMembers "a" Import scopeAndFrame heap scopeGraph) `shouldContain` [ "foo" ]
fromJust (SpecHelpers.lookupMembers "b" Import scopeAndFrame heap scopeGraph) `shouldContain` ["c"] fromJust (SpecHelpers.lookupMembers "b" Import scopeAndFrame heap scopeGraph) `shouldContain` ["c"]
@ -28,16 +28,16 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main1.py", "a.py", "b/__init__.py", "b/c.py"] (scopeGraph, (heap, res)) <- evaluate ["main1.py", "a.py", "b/__init__.py", "b/c.py"]
case ModuleTable.lookup "main1.py" <$> res of case ModuleTable.lookup "main1.py" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "e" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "e" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "imports using from syntax" $ do it "imports using from syntax" $ do
(scopeGraph, (heap, res)) <- evaluate ["main2.py", "a.py", "b/__init__.py", "b/c.py"] (scopeGraph, (heap, res)) <- evaluate ["main2.py", "a.py", "b/__init__.py", "b/c.py"]
case ModuleTable.lookup "main2.py" <$> res of case ModuleTable.lookup "main2.py" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
-- TODO: Enable when we constrain edge paths with path predicates -- TODO: Enable when we constrain edge paths with path predicates
-- () <$ SpecHelpers.lookupDeclaration "baz" heap scopeGraph `shouldBe` Nothing -- () <$ SpecHelpers.lookupDeclaration "baz" heap scopeGraph `shouldBe` Nothing
@ -47,7 +47,7 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main3.py", "c/__init__.py", "c/utils.py"] (scopeGraph, (heap, res)) <- evaluate ["main3.py", "c/__init__.py", "c/utils.py"]
case ModuleTable.lookup "main3.py" <$> res of case ModuleTable.lookup "main3.py" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "utils" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "utils" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
-- (lookupDeclaration "utils" heap >>= deNamespace heap) `shouldBe` Just ("utils", ["to_s"]) -- (lookupDeclaration "utils" heap >>= deNamespace heap) `shouldBe` Just ("utils", ["to_s"])
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -55,8 +55,8 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["subclass.py"] (scopeGraph, (heap, res)) <- evaluate ["subclass.py"]
case ModuleTable.lookup "subclass.py" <$> res of case ModuleTable.lookup "subclass.py" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
() <$ SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just [ "dang" ] SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just [ "dang" ]
value `shouldBe` String "\"bar\"" value `shouldBe` String "\"bar\""
other -> expectationFailure (show other) other -> expectationFailure (show other)

View File

@ -22,7 +22,7 @@ spec = parallel $ do
case ModuleTable.lookup "main.rb" <$> res of case ModuleTable.lookup "main.rb" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` Value.Integer (Number.Integer 1) value `shouldBe` Value.Integer (Number.Integer 1)
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "evaluates load" $ do it "evaluates load" $ do
@ -30,7 +30,7 @@ spec = parallel $ do
case ModuleTable.lookup "load.rb" <$> res of case ModuleTable.lookup "load.rb" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` Value.Integer (Number.Integer 1) value `shouldBe` Value.Integer (Number.Integer 1)
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "evaluates load with wrapper" $ do it "evaluates load with wrapper" $ do
@ -42,8 +42,8 @@ spec = parallel $ do
case ModuleTable.lookup "subclass.rb" <$> res of case ModuleTable.lookup "subclass.rb" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` String "\"<bar>\"" value `shouldBe` String "\"<bar>\""
() <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just ["baz", "foo", "inspect"] SpecHelpers.lookupMembers "Bar" Superclass scopeAndFrame heap scopeGraph `shouldBe` Just ["baz", "foo", "inspect"]
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -51,7 +51,7 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["modules.rb"] (scopeGraph, (heap, res)) <- evaluate ["modules.rb"]
case ModuleTable.lookup "modules.rb" <$> res of case ModuleTable.lookup "modules.rb" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "handles break correctly" $ do it "handles break correctly" $ do
@ -95,7 +95,7 @@ spec = parallel $ do
case ModuleTable.lookup "puts.rb" <$> res of case ModuleTable.lookup "puts.rb" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
value `shouldBe` Unit value `shouldBe` Unit
() <$ SpecHelpers.lookupDeclaration "puts" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "puts" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
where where

View File

@ -29,15 +29,15 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main6.ts", "baz.ts", "foo.ts"] (scopeGraph, (heap, res)) <- evaluate ["main6.ts", "baz.ts", "foo.ts"]
case ModuleTable.lookup "main6.ts" <$> res of case ModuleTable.lookup "main6.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "imports with aliased symbols" $ do it "imports with aliased symbols" $ do
(scopeGraph, (heap, res)) <- evaluate ["main.ts", "foo.ts", "foo/b.ts"] (scopeGraph, (heap, res)) <- evaluate ["main.ts", "foo.ts", "foo/b.ts"]
case ModuleTable.lookup "main.ts" <$> res of case ModuleTable.lookup "main.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "quz" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "quz" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -45,21 +45,21 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main1.ts", "foo.ts", "a.ts"] (scopeGraph, (heap, res)) <- evaluate ["main1.ts", "foo.ts", "a.ts"]
case ModuleTable.lookup "main1.ts" <$> res of case ModuleTable.lookup "main1.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
() <$ SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
() <$ SpecHelpers.lookupDeclaration "z" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "z" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
lookupMembers "b" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ] lookupMembers "b" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ]
lookupMembers "z" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ] lookupMembers "z" Import scopeAndFrame heap scopeGraph `shouldBe` Just [ "baz", "foo" ]
() <$ SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Nothing SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Nothing
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "stores function declaration in scope graph" $ do it "stores function declaration in scope graph" $ do
(scopeGraph, (heap, res)) <- evaluate ["a.ts"] (scopeGraph, (heap, res)) <- evaluate ["a.ts"]
case ModuleTable.lookup "a.ts" <$> res of case ModuleTable.lookup "a.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
() <$ SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
value `shouldBe` Unit value `shouldBe` Unit
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -67,7 +67,7 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main4.ts", "foo.ts"] (scopeGraph, (heap, res)) <- evaluate ["main4.ts", "foo.ts"]
case ModuleTable.lookup "main4.ts" <$> res of case ModuleTable.lookup "main4.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
value `shouldBe` String (pack "\"this is the foo function\"") value `shouldBe` String (pack "\"this is the foo function\"")
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -75,7 +75,7 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["main3.ts", "a.ts"] (scopeGraph, (heap, res)) <- evaluate ["main3.ts", "a.ts"]
case ModuleTable.lookup "main3.ts" <$> res of case ModuleTable.lookup "main3.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, value))) -> do Right (Just (Module _ (scopeAndFrame, value))) -> do
() <$ SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing
value `shouldBe` Unit value `shouldBe` Unit
Heap.heapSize heap `shouldBe` 4 Heap.heapSize heap `shouldBe` 4
other -> expectationFailure (show other) other -> expectationFailure (show other)
@ -88,7 +88,7 @@ spec = parallel $ do
(scopeGraph, (heap, res)) <- evaluate ["early-return.ts"] (scopeGraph, (heap, res)) <- evaluate ["early-return.ts"]
case ModuleTable.lookup "early-return.ts" <$> res of case ModuleTable.lookup "early-return.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> Right (Just (Module _ (scopeAndFrame, _))) ->
() <$ SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "evaluates sequence expressions" $ do it "evaluates sequence expressions" $ do
@ -117,7 +117,7 @@ spec = parallel $ do
case ModuleTable.lookup "await.ts" <$> res of case ModuleTable.lookup "await.ts" <$> res of
Right (Just (Module _ (scopeAndFrame, _))) -> do Right (Just (Module _ (scopeAndFrame, _))) -> do
-- Test that f2 is in the scopegraph and heap. -- Test that f2 is in the scopegraph and heap.
() <$ SpecHelpers.lookupDeclaration "f2" scopeAndFrame heap scopeGraph `shouldBe` Just () SpecHelpers.lookupDeclaration "f2" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust
-- Test we can't reference y from outside the function -- Test we can't reference y from outside the function
SpecHelpers.lookupDeclaration "y" scopeAndFrame heap scopeGraph `shouldBe` Nothing SpecHelpers.lookupDeclaration "y" scopeAndFrame heap scopeGraph `shouldBe` Nothing
other -> expectationFailure (show other) other -> expectationFailure (show other)