mirror of https://github.com/tc39/test262.git
Rename & merge "this not callable" tests
This commit is contained in:
parent
9c93e05d90
commit
385848d449
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2011 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.3.4.3_A13
|
||||
description: If IsCallable(func) is false, then throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Function.prototype.apply.call(undefined, {}, []);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2011 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.3.4.3_A14
|
||||
description: If IsCallable(func) is false, then throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Function.prototype.apply.call(null, {}, []);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2011 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.3.4.3_A15
|
||||
description: If IsCallable(func) is false, then throw a TypeError exception.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Function.prototype.apply.call({}, {}, []);
|
||||
});
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright 2011 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: If IsCallable(func) is false, then throw a TypeError exception.
|
||||
es5id: 15.3.4.3_A16
|
||||
description: >
|
||||
A RegExp is not a function, but it may be callable. Iff it is,
|
||||
it's typeof should be 'function', in which case apply should
|
||||
accept it as a valid this value.
|
||||
---*/
|
||||
|
||||
var re = (/x/);
|
||||
if (typeof re === 'function') {
|
||||
Function.prototype.apply.call(re, undefined, ['x']);
|
||||
} else {
|
||||
try {
|
||||
Function.prototype.bind.call(re, undefined);
|
||||
$ERROR('#1: If IsCallable(func) is false, ' +
|
||||
'then (bind should) throw a TypeError exception');
|
||||
} catch (e) {
|
||||
if (!(e instanceof TypeError)) {
|
||||
$ERROR('#1: TypeError expected. Actual: ' + e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// 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/, {}, []);
|
||||
});
|
Loading…
Reference in New Issue