fixes
This commit is contained in:
20
vm_suite.ce
20
vm_suite.ce
@@ -334,9 +334,10 @@ run("function call multiple args", function() {
|
||||
if (fn(1, 2, 3) != 6) fail("function call with multiple args failed")
|
||||
})
|
||||
|
||||
run("function call extra args", function() {
|
||||
run("function call extra args disrupts", function() {
|
||||
var fn = function(a, b) { return a + b }
|
||||
if (fn(1, 2, 3, 4) != 3) fail("function call with extra args failed")
|
||||
if (!should_disrupt(function() { fn(1, 2, 3, 4) }))
|
||||
fail("function call with extra args should disrupt")
|
||||
})
|
||||
|
||||
run("function call missing args", function() {
|
||||
@@ -344,6 +345,21 @@ run("function call missing args", function() {
|
||||
if (fn(1) != 1) fail("function call with missing args failed")
|
||||
})
|
||||
|
||||
run("closure call extra args disrupts", function() {
|
||||
var mk = function(base) {
|
||||
return function(x) { return base + x }
|
||||
}
|
||||
var add5 = mk(5)
|
||||
if (!should_disrupt(function() { add5(1, 2) }))
|
||||
fail("closure call with extra args should disrupt")
|
||||
})
|
||||
|
||||
run("call helper extra args disrupts", function() {
|
||||
var fn = function(a, b) { return a + b }
|
||||
if (!should_disrupt(function() { call(fn, null, [1, 2, 3]) }))
|
||||
fail("call helper should disrupt on extra args")
|
||||
})
|
||||
|
||||
run("function return", function() {
|
||||
var fn = function() { return 5 }
|
||||
if (fn() != 5) fail("function return failed")
|
||||
|
||||
Reference in New Issue
Block a user