From e0387bcee86f844300dd92b8abf3c2f5a95e57d9 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Tue, 26 May 2015 11:05:12 -0400 Subject: [PATCH] Refactor tests for built-in @@iterator methods Assert the value of the properties and update the test frontmatter to include the `Symbol.iterator` feature. --- .../Array/prototype/Symbol.iterator.js | 20 +++++++++++++++++++ .../Symbol.iterator/property-descriptor.js | 14 ------------- .../Symbol.iterator-property-descriptor.js | 14 ------------- .../Map/prototype/Symbol.iterator.js | 19 ++++++++++++++++++ .../Set/prototype/Symbol.iterator.js | 20 +++++++++++++++++++ .../Symbol.iterator/property-descriptor.js | 14 ------------- ...perty-descriptor.js => Symbol.iterator.js} | 1 + ...perty-descriptor.js => Symbol.iterator.js} | 1 + 8 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 test/built-ins/Array/prototype/Symbol.iterator.js delete mode 100644 test/built-ins/Array/prototype/Symbol.iterator/property-descriptor.js delete mode 100644 test/built-ins/Map/prototype/Symbol.iterator-property-descriptor.js create mode 100644 test/built-ins/Map/prototype/Symbol.iterator.js create mode 100644 test/built-ins/Set/prototype/Symbol.iterator.js delete mode 100644 test/built-ins/Set/prototype/Symbol.iterator/property-descriptor.js rename test/language/arguments-object/mapped/{Symbol.iterator/property-descriptor.js => Symbol.iterator.js} (95%) rename test/language/arguments-object/unmapped/{Symbol.iterator/property-descriptor.js => Symbol.iterator.js} (96%) diff --git a/test/built-ins/Array/prototype/Symbol.iterator.js b/test/built-ins/Array/prototype/Symbol.iterator.js new file mode 100644 index 0000000000..7cdcb81b89 --- /dev/null +++ b/test/built-ins/Array/prototype/Symbol.iterator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Initial state of the Symbol.iterator property +info: > + The initial value of the @@iterator property is the same function object as + the initial value of the Array.prototype.values property. + + Per ES6 section 17, the method should exist on the Array prototype, and it + should be writable and configurable, but not enumerable. +includes: [propertyHelper.js] +features: [Symbol.iterator] +es6id: 22.1.3.30 +---*/ + +assert.sameValue(Array.prototype[Symbol.iterator], Array.prototype.values); +verifyNotEnumerable(Array.prototype, Symbol.iterator); +verifyWritable(Array.prototype, Symbol.iterator); +verifyConfigurable(Array.prototype, Symbol.iterator); diff --git a/test/built-ins/Array/prototype/Symbol.iterator/property-descriptor.js b/test/built-ins/Array/prototype/Symbol.iterator/property-descriptor.js deleted file mode 100644 index f309b02ac4..0000000000 --- a/test/built-ins/Array/prototype/Symbol.iterator/property-descriptor.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2013 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- - description: > - The method should exist on the Array prototype, and it should be writable - and configurable, but not enumerable. - includes: [propertyHelper.js] - es6id: 22.1.3.4 - ---*/ - -verifyNotEnumerable(Array.prototype, Symbol.iterator); -verifyWritable(Array.prototype, Symbol.iterator); -verifyConfigurable(Array.prototype, Symbol.iterator); diff --git a/test/built-ins/Map/prototype/Symbol.iterator-property-descriptor.js b/test/built-ins/Map/prototype/Symbol.iterator-property-descriptor.js deleted file mode 100644 index c5e0f8ee3c..0000000000 --- a/test/built-ins/Map/prototype/Symbol.iterator-property-descriptor.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2014 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- - description: > - The method should exist on the Map prototype, and it should be writable - and configurable, but not enumerable. - includes: [propertyHelper.js] - es6id: 23.1.3.12 - ---*/ - -verifyNotEnumerable(Map.prototype, Symbol.iterator); -verifyWritable(Map.prototype, Symbol.iterator); -verifyConfigurable(Map.prototype, Symbol.iterator); diff --git a/test/built-ins/Map/prototype/Symbol.iterator.js b/test/built-ins/Map/prototype/Symbol.iterator.js new file mode 100644 index 0000000000..3c6a1d6e65 --- /dev/null +++ b/test/built-ins/Map/prototype/Symbol.iterator.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Initial state of the Symbol.iterator property +info: > + The initial value of the @@iterator property is the same function object as + the initial value of the entries property. + + Per ES6 section 17, the method should exist on the Array prototype, and it + should be writable and configurable, but not enumerable. +includes: [propertyHelper.js] +features: [Symbol.iterator] +es6id: 23.1.3.12 +---*/ + +verifyNotEnumerable(Map.prototype, Symbol.iterator); +verifyWritable(Map.prototype, Symbol.iterator); +verifyConfigurable(Map.prototype, Symbol.iterator); diff --git a/test/built-ins/Set/prototype/Symbol.iterator.js b/test/built-ins/Set/prototype/Symbol.iterator.js new file mode 100644 index 0000000000..1ae44d1fc8 --- /dev/null +++ b/test/built-ins/Set/prototype/Symbol.iterator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Initial state of the Symbol.iterator property +info: > + The initial value of the @@iterator property is the same function object as + the initial value of the values property. + + Per ES6 section 17, the method should exist on the Set prototype, and it + should be writable and configurable, but not enumerable. +includes: [propertyHelper.js] +features: [Symbol.iterator] +es6id: 23.2.3.11 +---*/ + +assert.sameValue(Set.prototype[Symbol.iterator], Set.prototype.values); +verifyNotEnumerable(Set.prototype, Symbol.iterator); +verifyWritable(Set.prototype, Symbol.iterator); +verifyConfigurable(Set.prototype, Symbol.iterator); diff --git a/test/built-ins/Set/prototype/Symbol.iterator/property-descriptor.js b/test/built-ins/Set/prototype/Symbol.iterator/property-descriptor.js deleted file mode 100644 index f41ed26702..0000000000 --- a/test/built-ins/Set/prototype/Symbol.iterator/property-descriptor.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2014 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- - description: > - The method should exist on the Array prototype, and it should be writable - and configurable, but not enumerable. - includes: [propertyHelper.js] - es6id: 23.2.3.11 - ---*/ - -verifyNotEnumerable(Set.prototype, Symbol.iterator); -verifyWritable(Set.prototype, Symbol.iterator); -verifyConfigurable(Set.prototype, Symbol.iterator); diff --git a/test/language/arguments-object/mapped/Symbol.iterator/property-descriptor.js b/test/language/arguments-object/mapped/Symbol.iterator.js similarity index 95% rename from test/language/arguments-object/mapped/Symbol.iterator/property-descriptor.js rename to test/language/arguments-object/mapped/Symbol.iterator.js index 3eacb7ad6b..3c25176392 100644 --- a/test/language/arguments-object/mapped/Symbol.iterator/property-descriptor.js +++ b/test/language/arguments-object/mapped/Symbol.iterator.js @@ -7,6 +7,7 @@ description: > protocol. includes: [propertyHelper.js] flags: [noStrict] +features: [Symbol.iterator] ---*/ (function() { diff --git a/test/language/arguments-object/unmapped/Symbol.iterator/property-descriptor.js b/test/language/arguments-object/unmapped/Symbol.iterator.js similarity index 96% rename from test/language/arguments-object/unmapped/Symbol.iterator/property-descriptor.js rename to test/language/arguments-object/unmapped/Symbol.iterator.js index a2c37c80b9..0b47c6c899 100644 --- a/test/language/arguments-object/unmapped/Symbol.iterator/property-descriptor.js +++ b/test/language/arguments-object/unmapped/Symbol.iterator.js @@ -7,6 +7,7 @@ description: > protocol. includes: [propertyHelper.js] flags: [noStrict] +features: [Symbol.iterator] ---*/ (function() {