mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-15 05:45:32 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
30
samples/Terra/emptystruct.t
Normal file
30
samples/Terra/emptystruct.t
Normal file
@@ -0,0 +1,30 @@
|
||||
terra f(x : {})
|
||||
return x
|
||||
end
|
||||
|
||||
print(f({}))
|
||||
|
||||
terra f2(x : {})
|
||||
return x,x
|
||||
end
|
||||
|
||||
print(f2({}))
|
||||
|
||||
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