1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Fix up python test and function args

This commit is contained in:
joshvera 2018-11-26 20:07:37 -05:00
parent 57015e94cc
commit 2b11d7aa2a
2 changed files with 3 additions and 11 deletions

View File

@ -1,6 +1,5 @@
module Analysis.Python.Spec (spec) where
import Data.Abstract.Environment as Env
import Data.Abstract.Evaluatable (EvalError(..))
import qualified Data.Abstract.ModuleTable as ModuleTable
import Data.Abstract.Value.Concrete
@ -20,9 +19,8 @@ spec config = parallel $ do
const () <$> SpecHelpers.lookupDeclaration "a" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "b" heap scopeGraph `shouldBe` Just ()
-- (lookupDeclaration "a" heap >>= deNamespace heap) `shouldBe` Just ("a", ["foo"])
-- (lookupDeclaration "b" heap >>= deNamespace heap) `shouldBe` Just ("b", ["c"])
undefined
(SpecHelpers.lookupDeclaration "a" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["foo"]
(SpecHelpers.lookupDeclaration "b" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["c"]
-- (derefQName heap ("b" :| ["c"]) env >>= deNamespace heap) `shouldBe` Just ("c", ["baz"])
other -> expectationFailure (show other)

View File

@ -34,13 +34,7 @@ spec = parallel $ do
(_, (_, expected)) <- evaluate $ do
withLexicalScopeAndFrame $ do
declare (ScopeGraph.Declaration "identity") emptySpan Nothing
valueRef <- function "identity" [ SpecEff (do
declare (ScopeGraph.Declaration "x") emptySpan Nothing
pure $ Rval (Value.Symbol $ pack "x"))
, SpecEff (do
declare (ScopeGraph.Declaration "y") emptySpan Nothing
pure $ Rval (Value.Symbol $ pack "y"))
]
valueRef <- function "identity" [ SpecHelpers.name "x", SpecHelpers.name "y" ]
(SpecEff (LvalMember <$> Heap.lookupDeclaration (ScopeGraph.Declaration (SpecHelpers.name "y"))))
identity <- value valueRef
val <- pure (integer 123)