Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Array / prototype / concat / create-species-non-ctor.js
blobfb102a60529cd41cb6fcc4774f85ae3e69c2189a
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-array.prototype.concat
5 description: >
6     Behavior when the @@species attribute is a non-constructor object
7 info: |
8     1. Let O be ? ToObject(this value).
9     2. Let A be ? ArraySpeciesCreate(O, 0).
11     9.4.2.3 ArraySpeciesCreate
13     [...]
14     5. Let C be ? Get(originalArray, "constructor").
15     [...]
16     7. If Type(C) is Object, then
17        a. Let C be ? Get(C, @@species).
18        b. If C is null, let C be undefined.
19     [...]
20     9. If IsConstructor(C) is false, throw a TypeError exception.
21 includes: [isConstructor.js]
22 features: [Symbol.species, Reflect.construct]
23 ---*/
25 assert.sameValue(
26   isConstructor(parseInt),
27   false,
28   'precondition: isConstructor(parseInt) must return false'
31 var a = [];
33 a.constructor = {};
34 a.constructor[Symbol.species] = parseInt;
36 assert.throws(TypeError, function() {
37   a.concat();
38 }, 'a.concat() throws a TypeError exception');
40 reportCompare(0, 0);