mirror of
https://github.com/github/semantic.git
synced 2024-12-28 17:32:05 +03:00
Add unit tests.
This commit is contained in:
parent
2d930aa19f
commit
2b3acea5fb
7
semantic-python/test/fixtures/2-06-nested-function-definition.py
vendored
Normal file
7
semantic-python/test/fixtures/2-06-nested-function-definition.py
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# CHECK-TREE: { const <- \a -> \b -> { identity <- \x -> x; identity a }; #record{ const: const }}
|
||||
|
||||
def const(a, b):
|
||||
def identity(x):
|
||||
return x
|
||||
|
||||
return identity(a)
|
11
semantic-python/test/fixtures/2-07-closure-over-scope.py
vendored
Normal file
11
semantic-python/test/fixtures/2-07-closure-over-scope.py
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# CHECK-JQ: .scope.zilch[0].b[0].span == { start: [8, 8], end: [ 8, 16 ] }
|
||||
# CHECK-JQ: .scope.result[0].a[0].span == { start: [5, 8], end: [ 5, 16 ] }
|
||||
|
||||
def const(a, b):
|
||||
def result():
|
||||
return a
|
||||
|
||||
def zilch(b):
|
||||
return b
|
||||
|
||||
return result()
|
7
semantic-python/test/fixtures/2-08-function-decorator.py
vendored
Normal file
7
semantic-python/test/fixtures/2-08-function-decorator.py
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# CHECK-TREE: { passthru <- \x -> x; decorated <- \x -> x; decorated = passthru(decorated); #record { passthru: passthru, decorated: decorated }}
|
||||
def passthru(x):
|
||||
return x
|
||||
|
||||
@passthru
|
||||
def decorated(x):
|
||||
return x
|
Loading…
Reference in New Issue
Block a user