mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-02-12 03:09:31 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
23
samples/Terra/luabridgefn.t
Normal file
23
samples/Terra/luabridgefn.t
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
terra plus1(a : int)
|
||||
return a + int(1)
|
||||
end
|
||||
|
||||
terra afn() : int -> int
|
||||
return plus1
|
||||
end
|
||||
|
||||
terra doit(a : int, b : int -> int)
|
||||
return b(a)
|
||||
end
|
||||
|
||||
local test = require("test")
|
||||
|
||||
local foobar = afn()
|
||||
test.eq(foobar(3),4)
|
||||
test.eq(doit(4,foobar),5)
|
||||
local function whatwhat(a)
|
||||
print("I GOT A ", a)
|
||||
return a + 3
|
||||
end
|
||||
test.eq(doit(5,whatwhat),8)
|
||||
Reference in New Issue
Block a user