Debian Codegraph @

js/src/tests/test262/built-ins/Reflect/apply/target-is-not-callable-throws.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 26.1.1
5 description: >
6 Throws a TypeError if `target` is not callable.
7 info: |
8 26.1.1 Reflect.apply ( target, thisArgument, argumentsList )
9
10 1. If IsCallable(target) is false, throw a TypeError exception.
11 ...
12
13 7.2.3 IsCallable ( argument )
14
15 1. ReturnIfAbrupt(argument).
16 2. If Type(argument) is not Object, return false.
17 3. If argument has a [[Call]] internal method, return true.
18 4. Return false.
19 features: [Reflect]
20 ---*/
21
22 assert.throws(TypeError, function() {
23 Reflect.apply(1, 1, []);
24 });
25
26 assert.throws(TypeError, function() {
27 Reflect.apply(null, 1, []);
28 });
29
30 assert.throws(TypeError, function() {
31 Reflect.apply({}, 1, []);
32 });
33
34 reportCompare(0, 0);