Add tests for return value of @@species accessors

This commit is contained in:
Mike Pennisi 2016-04-22 15:33:43 -04:00 committed by Gorkem Yakin
parent 9aa4dced8d
commit b8e40a6f3f
10 changed files with 108 additions and 17 deletions

View 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);

View File

@ -4,14 +4,18 @@
/*---
info: >
Array has a property at `Symbol.species`
esid: sec-get-array-@@species
es6id: 22.1.2.5
author: Sam Mikes
description: Array[Symbol.species] exists per spec
includes:
- propertyHelper.js
includes: [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);
verifyNotEnumerable(Array, Symbol.species);

View 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);

View File

@ -4,18 +4,18 @@
/*---
info: >
ArrayBuffer has a property at `Symbol.species`
esid: sec-get-arraybuffer-@@species
es6id: 24.1.3.3
author: Sam Mikes
description: ArrayBuffer[Symbol.species] exists per spec
features: [ ArrayBuffer, Symbol.species ]
includes:
- propertyHelper.js
includes: [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,
"get [Symbol.species]");
assert.sameValue(desc.set, undefined);
assert.sameValue(typeof desc.get, 'function');
verifyNotWritable(ArrayBuffer, Symbol.species, Symbol.species);
verifyNotEnumerable(ArrayBuffer, Symbol.species);

View 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);

View File

@ -4,14 +4,18 @@
/*---
info: >
Map has a property at `Symbol.species`
esid: sec-get-map-@@species
es6id: 23.1.2.2
author: Sam Mikes
description: Map[Symbol.species] exists per spec
includes:
- propertyHelper.js
includes: [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);
verifyNotEnumerable(Map, Symbol.species);

View 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);

View File

@ -4,14 +4,18 @@
/*---
info: >
RegExp has a property at `Symbol.species`
esid: sec-get-regexp-@@species
es6id: 21.2.4.2
author: Sam Mikes
description: RegExp[Symbol.species] exists per spec
includes:
- propertyHelper.js
includes: [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);
verifyNotEnumerable(RegExp, Symbol.species);

View 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);

View File

@ -4,14 +4,18 @@
/*---
info: >
Set has a property at `Symbol.species`
esid: sec-get-set-@@species
es6id: 23.2.2.2
author: Sam Mikes
description: Set[Symbol.species] exists per spec
includes:
- propertyHelper.js
includes: [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);
verifyNotEnumerable(Set, Symbol.species);