mirror of
https://github.com/tc39/test262.git
synced 2025-07-16 10:34:44 +02:00
Add tests for return value of @@species accessors
This commit is contained in:
parent
9aa4dced8d
commit
b8e40a6f3f
15
test/built-ins/Array/Symbol.species/return-value.js
Normal file
15
test/built-ins/Array/Symbol.species/return-value.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-array-@@species
|
||||||
|
es6id: 24.1.2.5
|
||||||
|
description: Return value of @@species accessor method
|
||||||
|
info: |
|
||||||
|
1. Return the this value.
|
||||||
|
features: [Symbol.species]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var thisVal = {};
|
||||||
|
var accessor = Object.getOwnPropertyDescriptor(Array, Symbol.species).get;
|
||||||
|
|
||||||
|
assert.sameValue(accessor.call(thisVal), thisVal);
|
@ -4,14 +4,18 @@
|
|||||||
/*---
|
/*---
|
||||||
info: >
|
info: >
|
||||||
Array has a property at `Symbol.species`
|
Array has a property at `Symbol.species`
|
||||||
|
esid: sec-get-array-@@species
|
||||||
es6id: 22.1.2.5
|
es6id: 22.1.2.5
|
||||||
author: Sam Mikes
|
author: Sam Mikes
|
||||||
description: Array[Symbol.species] exists per spec
|
description: Array[Symbol.species] exists per spec
|
||||||
includes:
|
includes: [propertyHelper.js]
|
||||||
- propertyHelper.js
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(Array[Symbol.species], Array, "Array[Symbol.species] is Array");
|
var desc = Object.getOwnPropertyDescriptor(Array, Symbol.species);
|
||||||
|
|
||||||
|
assert.sameValue(desc.set, undefined);
|
||||||
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
|
||||||
verifyNotWritable(Array, Symbol.species, Symbol.species);
|
verifyNotWritable(Array, Symbol.species, Symbol.species);
|
||||||
verifyNotEnumerable(Array, Symbol.species);
|
verifyNotEnumerable(Array, Symbol.species);
|
||||||
|
15
test/built-ins/ArrayBuffer/Symbol.species/return-value.js
Normal file
15
test/built-ins/ArrayBuffer/Symbol.species/return-value.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-arraybuffer-@@species
|
||||||
|
es6id: 24.1.3.3
|
||||||
|
description: Return value of @@species accessor method
|
||||||
|
info: |
|
||||||
|
1. Return the this value.
|
||||||
|
features: [Symbol.species]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var thisVal = {};
|
||||||
|
var accessor = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species).get;
|
||||||
|
|
||||||
|
assert.sameValue(accessor.call(thisVal), thisVal);
|
@ -4,18 +4,18 @@
|
|||||||
/*---
|
/*---
|
||||||
info: >
|
info: >
|
||||||
ArrayBuffer has a property at `Symbol.species`
|
ArrayBuffer has a property at `Symbol.species`
|
||||||
|
esid: sec-get-arraybuffer-@@species
|
||||||
es6id: 24.1.3.3
|
es6id: 24.1.3.3
|
||||||
author: Sam Mikes
|
author: Sam Mikes
|
||||||
description: ArrayBuffer[Symbol.species] exists per spec
|
description: ArrayBuffer[Symbol.species] exists per spec
|
||||||
features: [ ArrayBuffer, Symbol.species ]
|
features: [ ArrayBuffer, Symbol.species ]
|
||||||
includes:
|
includes: [propertyHelper.js]
|
||||||
- propertyHelper.js
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(ArrayBuffer[Symbol.species], ArrayBuffer, "ArrayBuffer[Symbol.species] is ArrayBuffer");
|
var desc = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
|
||||||
|
|
||||||
assert.sameValue(Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species).get.name,
|
assert.sameValue(desc.set, undefined);
|
||||||
"get [Symbol.species]");
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
|
||||||
verifyNotWritable(ArrayBuffer, Symbol.species, Symbol.species);
|
verifyNotWritable(ArrayBuffer, Symbol.species, Symbol.species);
|
||||||
verifyNotEnumerable(ArrayBuffer, Symbol.species);
|
verifyNotEnumerable(ArrayBuffer, Symbol.species);
|
||||||
|
15
test/built-ins/Map/Symbol.species/return-value.js
Normal file
15
test/built-ins/Map/Symbol.species/return-value.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-map-@@species
|
||||||
|
es6id: 23.1.2.2
|
||||||
|
description: Return value of @@species accessor method
|
||||||
|
info: |
|
||||||
|
1. Return the this value.
|
||||||
|
features: [Symbol.species]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var thisVal = {};
|
||||||
|
var accessor = Object.getOwnPropertyDescriptor(Map, Symbol.species).get;
|
||||||
|
|
||||||
|
assert.sameValue(accessor.call(thisVal), thisVal);
|
@ -4,14 +4,18 @@
|
|||||||
/*---
|
/*---
|
||||||
info: >
|
info: >
|
||||||
Map has a property at `Symbol.species`
|
Map has a property at `Symbol.species`
|
||||||
|
esid: sec-get-map-@@species
|
||||||
es6id: 23.1.2.2
|
es6id: 23.1.2.2
|
||||||
author: Sam Mikes
|
author: Sam Mikes
|
||||||
description: Map[Symbol.species] exists per spec
|
description: Map[Symbol.species] exists per spec
|
||||||
includes:
|
includes: [propertyHelper.js]
|
||||||
- propertyHelper.js
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(Map[Symbol.species], Map, "Map[Symbol.species] is Map");
|
var desc = Object.getOwnPropertyDescriptor(Map, Symbol.species);
|
||||||
|
|
||||||
|
assert.sameValue(desc.set, undefined);
|
||||||
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
|
||||||
verifyNotWritable(Map, Symbol.species, Symbol.species);
|
verifyNotWritable(Map, Symbol.species, Symbol.species);
|
||||||
verifyNotEnumerable(Map, Symbol.species);
|
verifyNotEnumerable(Map, Symbol.species);
|
||||||
|
15
test/built-ins/RegExp/Symbol.species/return-value.js
Normal file
15
test/built-ins/RegExp/Symbol.species/return-value.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-regexp-@@species
|
||||||
|
es6id: 21.2.4.2
|
||||||
|
description: Return value of @@species accessor method
|
||||||
|
info: |
|
||||||
|
1. Return the this value.
|
||||||
|
features: [Symbol.species]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var thisVal = {};
|
||||||
|
var accessor = Object.getOwnPropertyDescriptor(RegExp, Symbol.species).get;
|
||||||
|
|
||||||
|
assert.sameValue(accessor.call(thisVal), thisVal);
|
@ -4,14 +4,18 @@
|
|||||||
/*---
|
/*---
|
||||||
info: >
|
info: >
|
||||||
RegExp has a property at `Symbol.species`
|
RegExp has a property at `Symbol.species`
|
||||||
|
esid: sec-get-regexp-@@species
|
||||||
es6id: 21.2.4.2
|
es6id: 21.2.4.2
|
||||||
author: Sam Mikes
|
author: Sam Mikes
|
||||||
description: RegExp[Symbol.species] exists per spec
|
description: RegExp[Symbol.species] exists per spec
|
||||||
includes:
|
includes: [propertyHelper.js]
|
||||||
- propertyHelper.js
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(RegExp[Symbol.species], RegExp, "RegExp[Symbol.species] is RegExp");
|
var desc = Object.getOwnPropertyDescriptor(RegExp, Symbol.species);
|
||||||
|
|
||||||
|
assert.sameValue(desc.set, undefined);
|
||||||
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
|
||||||
verifyNotWritable(RegExp, Symbol.species, Symbol.species);
|
verifyNotWritable(RegExp, Symbol.species, Symbol.species);
|
||||||
verifyNotEnumerable(RegExp, Symbol.species);
|
verifyNotEnumerable(RegExp, Symbol.species);
|
||||||
|
15
test/built-ins/Set/Symbol.species/return-value.js
Normal file
15
test/built-ins/Set/Symbol.species/return-value.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-get-set-@@species
|
||||||
|
es6id: 23.2.2.2
|
||||||
|
description: Return value of @@species accessor method
|
||||||
|
info: |
|
||||||
|
1. Return the this value.
|
||||||
|
features: [Symbol.species]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var thisVal = {};
|
||||||
|
var accessor = Object.getOwnPropertyDescriptor(Set, Symbol.species).get;
|
||||||
|
|
||||||
|
assert.sameValue(accessor.call(thisVal), thisVal);
|
@ -4,14 +4,18 @@
|
|||||||
/*---
|
/*---
|
||||||
info: >
|
info: >
|
||||||
Set has a property at `Symbol.species`
|
Set has a property at `Symbol.species`
|
||||||
|
esid: sec-get-set-@@species
|
||||||
es6id: 23.2.2.2
|
es6id: 23.2.2.2
|
||||||
author: Sam Mikes
|
author: Sam Mikes
|
||||||
description: Set[Symbol.species] exists per spec
|
description: Set[Symbol.species] exists per spec
|
||||||
includes:
|
includes: [propertyHelper.js]
|
||||||
- propertyHelper.js
|
features: [Symbol.species]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(Set[Symbol.species], Set, "Set[Symbol.species] is Set");
|
var desc = Object.getOwnPropertyDescriptor(Set, Symbol.species);
|
||||||
|
|
||||||
|
assert.sameValue(desc.set, undefined);
|
||||||
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
|
||||||
verifyNotWritable(Set, Symbol.species, Symbol.species);
|
verifyNotWritable(Set, Symbol.species, Symbol.species);
|
||||||
verifyNotEnumerable(Set, Symbol.species);
|
verifyNotEnumerable(Set, Symbol.species);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user