1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Enable go import tests

Co-Authored-By: Rob Rix <rob.rix@github.com>
This commit is contained in:
joshvera 2018-11-26 13:29:59 -05:00
parent a1d2a09548
commit 799baa9415

View File

@ -1,6 +1,5 @@
module Analysis.Go.Spec (spec) where module Analysis.Go.Spec (spec) where
import Data.Abstract.Environment as Env
import Data.Abstract.Evaluatable (EvalError(..)) import Data.Abstract.Evaluatable (EvalError(..))
import qualified Data.Abstract.ModuleTable as ModuleTable import qualified Data.Abstract.ModuleTable as ModuleTable
import qualified Data.Language as Language import qualified Data.Language as Language
@ -15,11 +14,10 @@ spec config = parallel $ do
(_, res) <- evaluate ["main.go", "foo/foo.go", "bar/bar.go", "bar/rab.go"] (_, 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 _ (scopeGraph, (heap, valueRef)) :| [])) -> do Right (Just (Module _ (scopeGraph, (heap, valueRef)) :| [])) -> do
const () <$> SpecHelpers.lookupDeclaration "Bar" heap scopeGraph `shouldBe` Just () () <$ SpecHelpers.lookupDeclaration "foo" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "Rab" heap scopeGraph `shouldBe` Just () (SpecHelpers.lookupDeclaration "foo" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["New"]
const () <$> SpecHelpers.lookupDeclaration "foo" heap scopeGraph `shouldBe` Just () () <$ SpecHelpers.lookupDeclaration "main" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "main" heap scopeGraph `shouldBe` Just () () <$ SpecHelpers.lookupDeclaration "Bar" heap scopeGraph `shouldBe` Just ()
-- (lookupDeclaration "foo" heap >>= deNamespace heap) `shouldBe` Just ("foo", ["New"])
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