From b8e40a6f3f2282bcab2c66c2712abb5a8bff8545 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Fri, 22 Apr 2016 15:33:43 -0400 Subject: [PATCH] Add tests for return value of @@species accessors --- .../Array/Symbol.species/return-value.js | 15 +++++++++++++++ .../Array/Symbol.species/symbol-species.js | 10 +++++++--- .../ArrayBuffer/Symbol.species/return-value.js | 15 +++++++++++++++ .../ArrayBuffer/Symbol.species/symbol-species.js | 10 +++++----- test/built-ins/Map/Symbol.species/return-value.js | 15 +++++++++++++++ .../Map/Symbol.species/symbol-species.js | 10 +++++++--- .../RegExp/Symbol.species/return-value.js | 15 +++++++++++++++ .../RegExp/Symbol.species/symbol-species.js | 10 +++++++--- test/built-ins/Set/Symbol.species/return-value.js | 15 +++++++++++++++ .../Set/Symbol.species/symbol-species.js | 10 +++++++--- 10 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 test/built-ins/Array/Symbol.species/return-value.js create mode 100644 test/built-ins/ArrayBuffer/Symbol.species/return-value.js create mode 100644 test/built-ins/Map/Symbol.species/return-value.js create mode 100644 test/built-ins/RegExp/Symbol.species/return-value.js create mode 100644 test/built-ins/Set/Symbol.species/return-value.js diff --git a/test/built-ins/Array/Symbol.species/return-value.js b/test/built-ins/Array/Symbol.species/return-value.js new file mode 100644 index 0000000000..a0f3a35c2e --- /dev/null +++ b/test/built-ins/Array/Symbol.species/return-value.js @@ -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); diff --git a/test/built-ins/Array/Symbol.species/symbol-species.js b/test/built-ins/Array/Symbol.species/symbol-species.js index 1d62c861bc..a9a470281f 100644 --- a/test/built-ins/Array/Symbol.species/symbol-species.js +++ b/test/built-ins/Array/Symbol.species/symbol-species.js @@ -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); diff --git a/test/built-ins/ArrayBuffer/Symbol.species/return-value.js b/test/built-ins/ArrayBuffer/Symbol.species/return-value.js new file mode 100644 index 0000000000..139bd7353c --- /dev/null +++ b/test/built-ins/ArrayBuffer/Symbol.species/return-value.js @@ -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); diff --git a/test/built-ins/ArrayBuffer/Symbol.species/symbol-species.js b/test/built-ins/ArrayBuffer/Symbol.species/symbol-species.js index ed22d4a006..4362c57d38 100644 --- a/test/built-ins/ArrayBuffer/Symbol.species/symbol-species.js +++ b/test/built-ins/ArrayBuffer/Symbol.species/symbol-species.js @@ -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); diff --git a/test/built-ins/Map/Symbol.species/return-value.js b/test/built-ins/Map/Symbol.species/return-value.js new file mode 100644 index 0000000000..d50555536a --- /dev/null +++ b/test/built-ins/Map/Symbol.species/return-value.js @@ -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); diff --git a/test/built-ins/Map/Symbol.species/symbol-species.js b/test/built-ins/Map/Symbol.species/symbol-species.js index ca9742b710..7e82973598 100644 --- a/test/built-ins/Map/Symbol.species/symbol-species.js +++ b/test/built-ins/Map/Symbol.species/symbol-species.js @@ -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); diff --git a/test/built-ins/RegExp/Symbol.species/return-value.js b/test/built-ins/RegExp/Symbol.species/return-value.js new file mode 100644 index 0000000000..07dbd37458 --- /dev/null +++ b/test/built-ins/RegExp/Symbol.species/return-value.js @@ -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); diff --git a/test/built-ins/RegExp/Symbol.species/symbol-species.js b/test/built-ins/RegExp/Symbol.species/symbol-species.js index 453bcdfae3..df3f10443c 100644 --- a/test/built-ins/RegExp/Symbol.species/symbol-species.js +++ b/test/built-ins/RegExp/Symbol.species/symbol-species.js @@ -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); diff --git a/test/built-ins/Set/Symbol.species/return-value.js b/test/built-ins/Set/Symbol.species/return-value.js new file mode 100644 index 0000000000..c1d60a8a81 --- /dev/null +++ b/test/built-ins/Set/Symbol.species/return-value.js @@ -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); diff --git a/test/built-ins/Set/Symbol.species/symbol-species.js b/test/built-ins/Set/Symbol.species/symbol-species.js index 6f9763199e..3305933299 100644 --- a/test/built-ins/Set/Symbol.species/symbol-species.js +++ b/test/built-ins/Set/Symbol.species/symbol-species.js @@ -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);