diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Function/prototype/apply/this-not-callable.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Function/prototype/apply/this-not-callable.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Function/prototype/apply/this-not-callable.js b/js/src/tests/test262/built-ins/Function/prototype/apply/this-not-callable.js new file mode 100644 index 0000000000..f0b6b63382 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/prototype/apply/this-not-callable.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function.prototype.apply +description: > + Throws a TypeError exception if this value is not callable +info: | + Function.prototype.apply ( thisArg, argArray ) + + 1. Let func be the this value. + 2. If IsCallable(func) is false, throw a TypeError exception. +---*/ + +assert.throws(TypeError, function() { + Function.prototype.apply.call(undefined, {}, []); +}); + +assert.throws(TypeError, function() { + Function.prototype.apply.call(null, {}, []); +}); + +assert.throws(TypeError, function() { + Function.prototype.apply.call({}, {}, []); +}); + +assert.throws(TypeError, function() { + Function.prototype.apply.call(/re/, {}, []); +}); + +reportCompare(0, 0); |