mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Define simple function test
This commit is contained in:
parent
67b96aa450
commit
ff988e048c
@ -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
|
||||
|
4
semantic-python/test/fixtures/5-02-simple-function.py
vendored
Normal file
4
semantic-python/test/fixtures/5-02-simple-function.py
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
def foo():
|
||||
return "hello world"
|
||||
|
||||
foo()
|
Loading…
Reference in New Issue
Block a user