1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Add unit tests.

This commit is contained in:
Patrick Thomson 2019-10-11 11:50:22 -04:00
parent 2d930aa19f
commit 2b3acea5fb
3 changed files with 25 additions and 0 deletions

View 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)

View 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()

View 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