summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Function/prototype/apply/argarray-not-object.js
blob: 2c860c7833045d923a0a5b902ac1b1f1e78968b0 (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
35
36
37
// 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 argArray is not an object
info: |
  Function.prototype.apply ( thisArg, argArray )

  [...]
  4. Let argList be ? CreateListFromArrayLike(argArray).

  CreateListFromArrayLike ( obj [ , elementTypes ] )

  [...]
  2. If Type(obj) is not Object, throw a TypeError exception.
---*/

function fn() {}

assert.throws(TypeError, function() {
  fn.apply(null, true);
});

assert.throws(TypeError, function() {
  fn.apply(null, NaN);
});

assert.throws(TypeError, function() {
  fn.apply(null, '1,2,3');
});

assert.throws(TypeError, function() {
  fn.apply(null, Symbol());
});

reportCompare(0, 0);