Skip to content

Commit

Permalink
issue #198 Tests for op_call instruction - couple fail due to missing…
Browse files Browse the repository at this point in the history
… support for multiret in return
  • Loading branch information
dibyendumajumdar committed Oct 24, 2020
1 parent d0b3ed9 commit 69840ea
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/comptests/09_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function g() return 4.2 end
f = compiler.load('return g()')
assert(f and type(f) == 'function')
local a = f()
assert(a == 4.2)
6 changes: 6 additions & 0 deletions tests/comptests/10_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function g() return 3, 4.2 end
f = compiler.load('return g()')
assert(f and type(f) == 'function')
local a, b = f()
assert(a == 3)
assert(b == 4.2)
6 changes: 6 additions & 0 deletions tests/comptests/11_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function g() return 3, 4.2 end
f = compiler.load('return g(), 1')
assert(f and type(f) == 'function')
local a, b = f()
assert(a == 3)
assert(b == 1)
7 changes: 7 additions & 0 deletions tests/comptests/12_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function g() return 3, 4.2 end
f = compiler.load('return 0, g(), 1')
assert(f and type(f) == 'function')
local a, b, c = f()
assert(a == 0)
assert(b == 3)
assert(c == 1)
11 changes: 11 additions & 0 deletions tests/comptests/13_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
g = compiler.load('return 3, 4.2')
assert(g and type(g) == 'function')
local a, b = g()
assert(a == 3)
assert(b == 4.2)
f = compiler.load('return 0, g(), 1')
assert(f and type(f) == 'function')
local a, b, c = f()
assert(a == 0)
assert(b == 3)
assert(c == 1)

0 comments on commit 69840ea

Please sign in to comment.