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

Define simple function test

This commit is contained in:
joshvera 2020-01-22 17:31:28 -05:00
parent 67b96aa450
commit ff988e048c
2 changed files with 9 additions and 5 deletions

View File

@ -87,17 +87,17 @@ assertSimpleReference = do
expectedLexicalScope :: (Has Sketch sig m) => m Result
expectedLexicalScope = do
declare "x" (DeclProperties ScopeGraph.Assignment ScopeGraph.Default Nothing)
reference "x" "x" RefProperties {}
declare "foo" (DeclProperties ScopeGraph.Function ScopeGraph.Default Nothing)
reference "foo" "foo" RefProperties {}
pure Complete
assertLexicalScope :: HUnit.Assertion
assertLexicalScope = do
let path = "semantic-python/test/fixtures/5-02-simple-function.py"
(result, Complete) <- graphFile path
let (expecto, Complete) = run $ runSketch Nothing expectedReference
(graph, result) <- graphFile path
let (expecto, Complete) = run $ runSketch Nothing expectedLexicalScope
HUnit.assertEqual "Should work for simple case" expecto result
HUnit.assertEqual "Should work for simple case" expecto graph
main :: IO ()
main = do

View File

@ -0,0 +1,4 @@
def foo():
return "hello world"
foo()