summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Reflect/apply/target-is-not-callable-throws.js
blob: b795a5bdc4bd3ac5cacf10fd47b45911deba879a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 26.1.1
description: >
  Throws a TypeError if `target` is not callable.
info: |
  26.1.1 Reflect.apply ( target, thisArgument, argumentsList )

  1. If IsCallable(target) is false, throw a TypeError exception.
  ...

  7.2.3 IsCallable ( argument )

  1. ReturnIfAbrupt(argument).
  2. If Type(argument) is not Object, return false.
  3. If argument has a [[Call]] internal method, return true.
  4. Return false.
features: [Reflect]
---*/

assert.throws(TypeError, function() {
  Reflect.apply(1, 1, []);
});

assert.throws(TypeError, function() {
  Reflect.apply(null, 1, []);
});

assert.throws(TypeError, function() {
  Reflect.apply({}, 1, []);
});

reportCompare(0, 0);