mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 04:18:48 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
31
samples/Terra/emptycalls.t
Normal file
31
samples/Terra/emptycalls.t
Normal file
@@ -0,0 +1,31 @@
|
||||
terra f(x : {})
|
||||
return x
|
||||
end
|
||||
|
||||
|
||||
print(f({}))
|
||||
|
||||
terra f2(x : {})
|
||||
return x,x
|
||||
end
|
||||
|
||||
print(f2({})._0)
|
||||
|
||||
terra f3(x : {}, a : int)
|
||||
return a + 1
|
||||
end
|
||||
|
||||
assert(f3({},3) == 4)
|
||||
|
||||
terra f4(x : {})
|
||||
return x,4
|
||||
end
|
||||
|
||||
a = f4({})
|
||||
assert(a._1 == 4)
|
||||
|
||||
terra f5()
|
||||
return f({})
|
||||
end
|
||||
|
||||
f5()
|
||||
Reference in New Issue
Block a user