1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Correct the test of bad exports.

Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
Rob Rix 2018-12-06 12:59:16 -05:00
parent 5eb73810eb
commit 7e20624506

View File

@ -1,5 +1,6 @@
module Analysis.TypeScript.Spec (spec) where module Analysis.TypeScript.Spec (spec) where
import Control.Abstract.ScopeGraph
import Control.Abstract.Value as Value import Control.Abstract.Value as Value
import Control.Arrow ((&&&)) import Control.Arrow ((&&&))
import Data.Abstract.Evaluatable import Data.Abstract.Evaluatable
@ -80,12 +81,8 @@ spec config = parallel $ do
other -> expectationFailure (show other) other -> expectationFailure (show other)
it "fails exporting symbols not defined in the module" $ do it "fails exporting symbols not defined in the module" $ do
(scopeGraph, (heap, res)) <- evaluate ["bad-export.ts", "pip.ts", "a.ts", "foo.ts"] (_, (_, res)) <- evaluate ["bad-export.ts", "pip.ts", "a.ts", "foo.ts"]
case ModuleTable.lookup "bad-export.ts" <$> res of res `shouldBe` Left (SomeError (inject @(BaseError (ScopeError Precise)) (BaseError (ModuleInfo "bad-export.ts") (Span (Pos 2 1) (Pos 2 28)) ImportReferenceError)))
Right (Just (Module _ (scopeAndFrame, valueRef) :| [])) -> do
SpecHelpers.lookupDeclaration "pip" scopeAndFrame heap scopeGraph `shouldBe` Nothing
valueRef `shouldBe` Rval Unit
other -> expectationFailure (show other)
it "evaluates early return statements" $ do it "evaluates early return statements" $ do
(scopeGraph, (heap, res)) <- evaluate ["early-return.ts"] (scopeGraph, (heap, res)) <- evaluate ["early-return.ts"]