1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Fix up tests

This commit is contained in:
Rick Winfrey 2018-08-06 09:29:24 -07:00
parent f0688f11b7
commit 7a06b8c922
2 changed files with 8 additions and 4 deletions

View File

@ -2,6 +2,7 @@ module Analysis.TypeScript.Spec (spec) where
import Control.Arrow ((&&&))
import Data.Abstract.Environment as Env
import Data.Abstract.ErrorContext
import Data.Abstract.Evaluatable
import Data.Abstract.Number as Number
import qualified Data.Abstract.ModuleTable as ModuleTable
@ -38,7 +39,7 @@ spec config = parallel $ do
it "fails exporting symbols not defined in the module" $ do
(_, (_, res)) <- evaluate ["bad-export.ts", "pip.ts", "a.ts", "foo.ts"]
res `shouldBe` Left (SomeExc (inject @EvalError (ExportError "foo.ts" (name "pip"))))
res `shouldBe` Left (SomeExc (inject @(BaseError EvalError) (BaseError (ErrorContext lowerBound lowerBound) (ExportError "foo.ts" (name "pip")))))
it "evaluates early return statements" $ do
(_, (heap, res)) <- evaluate ["early-return.ts"]

View File

@ -5,6 +5,7 @@ module Control.Abstract.Evaluator.Spec
) where
import Control.Abstract
import Data.Abstract.ErrorContext
import Data.Abstract.Module
import qualified Data.Abstract.Number as Number
import Data.Abstract.Package
@ -35,6 +36,7 @@ evaluate
. runFresh 0
. runReader (PackageInfo (name "test") mempty)
. runReader (ModuleInfo "test/Control/Abstract/Evaluator/Spec.hs")
. runReader (lowerBound @Span)
. fmap reassociate
. runValueError
. runEnvironmentError
@ -58,9 +60,10 @@ newtype SpecEff a = SpecEff
, Env Precise
, Allocator Precise Val
, Deref Precise Val
, Resumable (AddressError Precise Val)
, Resumable (EnvironmentError Precise)
, Resumable (ValueError Precise SpecEff)
, Resumable (BaseError (AddressError Precise Val))
, Resumable (BaseError (EnvironmentError Precise))
, Resumable (BaseError (ValueError Precise SpecEff))
, Reader Span
, Reader ModuleInfo
, Reader PackageInfo
, Fresh