1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +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 module Analysis.Python.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 Data.Abstract.Value.Concrete import Data.Abstract.Value.Concrete
@ -20,9 +19,8 @@ spec config = parallel $ do
const () <$> SpecHelpers.lookupDeclaration "a" heap scopeGraph `shouldBe` Just () const () <$> SpecHelpers.lookupDeclaration "a" heap scopeGraph `shouldBe` Just ()
const () <$> SpecHelpers.lookupDeclaration "b" heap scopeGraph `shouldBe` Just () const () <$> SpecHelpers.lookupDeclaration "b" heap scopeGraph `shouldBe` Just ()
-- (lookupDeclaration "a" heap >>= deNamespace heap) `shouldBe` Just ("a", ["foo"]) (SpecHelpers.lookupDeclaration "a" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["foo"]
-- (lookupDeclaration "b" heap >>= deNamespace heap) `shouldBe` Just ("b", ["c"]) (SpecHelpers.lookupDeclaration "b" heap scopeGraph >>= objectMembers heap scopeGraph . head) `shouldBe` Just ["c"]
undefined
-- (derefQName heap ("b" :| ["c"]) env >>= deNamespace heap) `shouldBe` Just ("c", ["baz"]) -- (derefQName heap ("b" :| ["c"]) env >>= deNamespace heap) `shouldBe` Just ("c", ["baz"])
other -> expectationFailure (show other) other -> expectationFailure (show other)

View File

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