fixes
This commit is contained in:
@@ -357,9 +357,12 @@ return {
|
||||
if (fn(1, 2, 3) != 6) return "function call with multiple args failed"
|
||||
},
|
||||
|
||||
test_function_call_extra_args: function() {
|
||||
test_function_call_extra_args_disrupts: function() {
|
||||
var fn = function(a, b) { return a + b }
|
||||
if (fn(1, 2, 3, 4) != 3) return "function call with extra args failed"
|
||||
var caught = false
|
||||
var _fn = function() { fn(1, 2, 3, 4) } disruption { caught = true }
|
||||
_fn()
|
||||
if (!caught) return "function call with extra args should disrupt"
|
||||
},
|
||||
|
||||
test_function_call_missing_args: function() {
|
||||
@@ -367,6 +370,25 @@ return {
|
||||
if (fn(1) != 1) return "function call with missing args failed"
|
||||
},
|
||||
|
||||
test_function_closure_extra_args_disrupts: function() {
|
||||
var mk = function(base) {
|
||||
return function(x) { return base + x }
|
||||
}
|
||||
var add5 = mk(5)
|
||||
var caught = false
|
||||
var _fn = function() { add5(1, 2) } disruption { caught = true }
|
||||
_fn()
|
||||
if (!caught) return "closure call with extra args should disrupt"
|
||||
},
|
||||
|
||||
test_call_helper_extra_args_disrupts: function() {
|
||||
var fn = function(a, b) { return a + b }
|
||||
var caught = false
|
||||
var _fn = function() { call(fn, null, [1, 2, 3]) } disruption { caught = true }
|
||||
_fn()
|
||||
if (!caught) return "call helper should disrupt on extra args"
|
||||
},
|
||||
|
||||
test_function_return: function() {
|
||||
var fn = function() { return 5 }
|
||||
if (fn() != 5) return "function return failed"
|
||||
|
||||
Reference in New Issue
Block a user