1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +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
import Data.Abstract.Environment as Env
import Data.Abstract.Evaluatable (EvalError(..))
import qualified Data.Abstract.ModuleTable as ModuleTable
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"]
case ModuleTable.lookup "main.go" <$> res of
Right (Just (Module _ (scopeGraph, (heap, valueRef)) :| [])) -> do
const () <$> SpecHelpers.lookupDeclaration "Bar" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "Rab" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "foo" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "main" heap scopeGraph `shouldBe` Just ()
-- (lookupDeclaration "foo" heap >>= deNamespace heap) `shouldBe` Just ("foo", ["New"])
() <$ SpecHelpers.lookupDeclaration "foo" heap scopeGraph `shouldBe` Just ()
(SpecHelpers.lookupDeclaration "foo" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["New"]
() <$ SpecHelpers.lookupDeclaration "main" heap scopeGraph `shouldBe` Just ()
() <$ SpecHelpers.lookupDeclaration "Bar" heap scopeGraph `shouldBe` Just ()
other -> expectationFailure (show other)
it "imports with aliases (and side effects only)" $ do