From d6bbbc9aed41c430d4d79f2f3c018a02665fb1d4 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Fri, 7 Aug 2015 18:40:04 -0400 Subject: [PATCH] Add tests for well-known Symbol: @@toStringTag --- .../prototype/Symbol.toStringTag.js | 21 ++++++++ .../Symbol.toStringTag/property-descriptor.js | 18 ++++--- .../DataView/prototype/Symbol.toStringTag.js | 21 ++++++++ .../{toStringTag.js => Symbol.toStringTag.js} | 9 +++- .../GeneratorPrototype/Symbol.toStringTag.js | 9 +++- test/built-ins/JSON/Symbol.toStringTag.js | 21 ++++++++ .../Map/prototype/Symbol.toStringTag.js | 21 ++++++++ .../Symbol.toStringTag/property-descriptor.js | 21 -------- .../Symbol.toStringTag.js | 12 +++-- test/built-ins/Math/Symbol.toStringTag.js | 21 ++++++++ .../prototype/toString/get-symbol-tag-err.js | 22 ++++++++ .../prototype/toString/symbol-tag-non-str.js | 38 +++++++++++++ .../prototype/toString/symbol-tag-override.js | 53 +++++++++++++++++++ .../prototype/toString/symbol-tag-str.js | 20 +++++++ .../Promise/prototype/Symbol.toStringTag.js | 21 ++++++++ .../Set/prototype/Symbol.toStringTag.js | 21 ++++++++ .../Symbol.toStringTag.js | 13 +++-- .../Symbol.toStringTag.js | 11 ++-- .../prototype/@@toStringTag/@@toStringTag.js | 12 ----- .../Symbol/prototype/Symbol.toStringTag.js | 21 ++++++++ .../built-ins/Symbol/toStringTag/prop-desc.js | 17 ++++++ .../WeakMap/prototype/Symbol.toStringTag.js | 21 ++++++++ .../Symbol.toStringTag/property-descriptor.js | 26 --------- .../WeakSet/prototype/Symbol.toStringTag.js | 21 ++++++++ .../Symbol.toStringTag/property-descriptor.js | 27 ---------- 25 files changed, 414 insertions(+), 104 deletions(-) create mode 100644 test/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js create mode 100644 test/built-ins/DataView/prototype/Symbol.toStringTag.js rename test/built-ins/GeneratorFunction/prototype/{toStringTag.js => Symbol.toStringTag.js} (66%) create mode 100644 test/built-ins/JSON/Symbol.toStringTag.js create mode 100644 test/built-ins/Map/prototype/Symbol.toStringTag.js delete mode 100644 test/built-ins/Map/prototype/Symbol.toStringTag/property-descriptor.js create mode 100644 test/built-ins/Math/Symbol.toStringTag.js create mode 100644 test/built-ins/Object/prototype/toString/get-symbol-tag-err.js create mode 100644 test/built-ins/Object/prototype/toString/symbol-tag-non-str.js create mode 100644 test/built-ins/Object/prototype/toString/symbol-tag-override.js create mode 100644 test/built-ins/Object/prototype/toString/symbol-tag-str.js create mode 100644 test/built-ins/Promise/prototype/Symbol.toStringTag.js create mode 100644 test/built-ins/Set/prototype/Symbol.toStringTag.js delete mode 100644 test/built-ins/Symbol/prototype/@@toStringTag/@@toStringTag.js create mode 100644 test/built-ins/Symbol/prototype/Symbol.toStringTag.js create mode 100644 test/built-ins/Symbol/toStringTag/prop-desc.js create mode 100644 test/built-ins/WeakMap/prototype/Symbol.toStringTag.js delete mode 100644 test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js create mode 100644 test/built-ins/WeakSet/prototype/Symbol.toStringTag.js delete mode 100644 test/built-ins/WeakSet/prototype/Symbol.toStringTag/property-descriptor.js diff --git a/test/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js b/test/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..e096acf395 --- /dev/null +++ b/test/built-ins/ArrayBuffer/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 24.1.4.4 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "ArrayBuffer". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(ArrayBuffer.prototype[Symbol.toStringTag], 'ArrayBuffer'); + +verifyNotEnumerable(ArrayBuffer.prototype, Symbol.toStringTag); +verifyNotWritable(ArrayBuffer.prototype, Symbol.toStringTag); +verifyConfigurable(ArrayBuffer.prototype, Symbol.toStringTag); diff --git a/test/built-ins/ArrayIteratorPrototype/Symbol.toStringTag/property-descriptor.js b/test/built-ins/ArrayIteratorPrototype/Symbol.toStringTag/property-descriptor.js index a146fe49de..776df3a5a9 100644 --- a/test/built-ins/ArrayIteratorPrototype/Symbol.toStringTag/property-descriptor.js +++ b/test/built-ins/ArrayIteratorPrototype/Symbol.toStringTag/property-descriptor.js @@ -2,12 +2,18 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- - description: > - `Object.prototype.getOwnPropertyDescriptor` should reflect the value and - writability of the @@toStringTag attribute. - includes: [propertyHelper.js] - es6id: 22.1.5.2.2 - ---*/ +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value "Array + Iterator". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +features: [Symbol.iterator, Symbol.toStringTag] +includes: [propertyHelper.js] +es6id: 22.1.5.2.2 +---*/ var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); diff --git a/test/built-ins/DataView/prototype/Symbol.toStringTag.js b/test/built-ins/DataView/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..87fa327592 --- /dev/null +++ b/test/built-ins/DataView/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 24.2.4.21 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "DataView". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(DataView.prototype[Symbol.toStringTag], 'DataView'); + +verifyNotEnumerable(DataView.prototype, Symbol.toStringTag); +verifyNotWritable(DataView.prototype, Symbol.toStringTag); +verifyConfigurable(DataView.prototype, Symbol.toStringTag); diff --git a/test/built-ins/GeneratorFunction/prototype/toStringTag.js b/test/built-ins/GeneratorFunction/prototype/Symbol.toStringTag.js similarity index 66% rename from test/built-ins/GeneratorFunction/prototype/toStringTag.js rename to test/built-ins/GeneratorFunction/prototype/Symbol.toStringTag.js index 3008a50608..e542b8dd11 100644 --- a/test/built-ins/GeneratorFunction/prototype/toStringTag.js +++ b/test/built-ins/GeneratorFunction/prototype/Symbol.toStringTag.js @@ -3,9 +3,16 @@ /*--- description: > - The GeneratorFunctionPrototype defines an `@@toStringTag` property. + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "GeneratorFunction". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. es6id: 25.2.3.3 includes: [propertyHelper.js] +features: [Symbol.toStringTag] ---*/ var GeneratorFunctionPrototype = Object.getPrototypeOf(function*() {}); diff --git a/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js b/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js index f684cd9c72..29a62affd6 100644 --- a/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js +++ b/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js @@ -3,9 +3,16 @@ /*--- description: > - The Generator prototype defines a `@@toStringTag` attribute. + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Generator". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. es6id: 25.3.1.5 includes: [propertyHelper.js] +features: [Symbol.toStringTag] ---*/ var GeneratorPrototype = Object.getPrototypeOf( diff --git a/test/built-ins/JSON/Symbol.toStringTag.js b/test/built-ins/JSON/Symbol.toStringTag.js new file mode 100644 index 0000000000..2c37ee9c2d --- /dev/null +++ b/test/built-ins/JSON/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 24.3.3 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "JSON". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(JSON[Symbol.toStringTag], 'JSON'); + +verifyNotEnumerable(JSON, Symbol.toStringTag); +verifyNotWritable(JSON, Symbol.toStringTag); +verifyConfigurable(JSON, Symbol.toStringTag); diff --git a/test/built-ins/Map/prototype/Symbol.toStringTag.js b/test/built-ins/Map/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..cf9a86f70b --- /dev/null +++ b/test/built-ins/Map/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.1.3.13 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Map". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Map.prototype[Symbol.toStringTag], 'Map'); + +verifyNotEnumerable(Map.prototype, Symbol.toStringTag); +verifyNotWritable(Map.prototype, Symbol.toStringTag); +verifyConfigurable(Map.prototype, Symbol.toStringTag); diff --git a/test/built-ins/Map/prototype/Symbol.toStringTag/property-descriptor.js b/test/built-ins/Map/prototype/Symbol.toStringTag/property-descriptor.js deleted file mode 100644 index efc2514cf9..0000000000 --- a/test/built-ins/Map/prototype/Symbol.toStringTag/property-descriptor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 23.1.3.13 -description: > - Map.prototype[ @@toStringTag ] value and descriptor. -includes: [propertyHelper.js] -features: [Symbol.toStringTag] - ---*/ - -var MapProto = Object.getPrototypeOf(new Map()); - -assert.sameValue( - MapProto[Symbol.toStringTag], - 'Map', - 'The value of MapProto[Symbol.toStringTag] is Map' -); - -verifyNotEnumerable(MapProto, Symbol.toStringTag); -verifyNotWritable(MapProto, Symbol.toStringTag); -verifyConfigurable(MapProto, Symbol.toStringTag); diff --git a/test/built-ins/MapIteratorPrototype/Symbol.toStringTag.js b/test/built-ins/MapIteratorPrototype/Symbol.toStringTag.js index d69331c9cc..3139c5fa21 100644 --- a/test/built-ins/MapIteratorPrototype/Symbol.toStringTag.js +++ b/test/built-ins/MapIteratorPrototype/Symbol.toStringTag.js @@ -3,10 +3,16 @@ /*--- es6id: 23.1.5.2.2 description: > - `Object.prototype.getOwnPropertyDescriptor` should reflect the value and - writability of the @@toStringTag attribute. + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Map Iterator". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. includes: [propertyHelper.js] - ---*/ +features: [Symbol.iterator, Symbol.toStringTag] +---*/ var MapIteratorProto = Object.getPrototypeOf(new Map()[Symbol.iterator]()); diff --git a/test/built-ins/Math/Symbol.toStringTag.js b/test/built-ins/Math/Symbol.toStringTag.js new file mode 100644 index 0000000000..8ba869e3af --- /dev/null +++ b/test/built-ins/Math/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 20.2.1.9 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Math". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Math[Symbol.toStringTag], 'Math'); + +verifyNotEnumerable(Math, Symbol.toStringTag); +verifyNotWritable(Math, Symbol.toStringTag); +verifyConfigurable(Math, Symbol.toStringTag); diff --git a/test/built-ins/Object/prototype/toString/get-symbol-tag-err.js b/test/built-ins/Object/prototype/toString/get-symbol-tag-err.js new file mode 100644 index 0000000000..0634763d9f --- /dev/null +++ b/test/built-ins/Object/prototype/toString/get-symbol-tag-err.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Behavior if error is thrown when accessing `Symbol.toStringTag` property +es6id: 19.1.3.6 +info: > + 16. Let tag be Get (O, @@toStringTag). + 17. ReturnIfAbrupt(tag). +features: [Symbol.toStringTag] +---*/ + +var poisonedToStringTag = Object.defineProperty({}, Symbol.toStringTag, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + poisonedToStringTag.toString(); +}); diff --git a/test/built-ins/Object/prototype/toString/symbol-tag-non-str.js b/test/built-ins/Object/prototype/toString/symbol-tag-non-str.js new file mode 100644 index 0000000000..556444fdda --- /dev/null +++ b/test/built-ins/Object/prototype/toString/symbol-tag-non-str.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Non-string values of `Symbol.toStringTag` property are ignored +es6id: 19.1.3.6 +info: > + 16. Let tag be Get (O, @@toStringTag). + 17. ReturnIfAbrupt(tag). + 18. If Type(tag) is not String, let tag be builtinTag. + 19. Return the String that is the result of concatenating "[object ", tag, + and "]". +features: [Symbol.toStringTag] +---*/ + +var custom = {}; + +custom[Symbol.toStringTag] = undefined; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = null; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = Symbol.toStringTag; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = 86; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = new String('test262'); +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = {}; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); + +custom[Symbol.toStringTag] = { toString: function() { return 'str'; } }; +assert.sameValue(Object.prototype.toString.call(custom), '[object Object]'); diff --git a/test/built-ins/Object/prototype/toString/symbol-tag-override.js b/test/built-ins/Object/prototype/toString/symbol-tag-override.js new file mode 100644 index 0000000000..2a30e22acd --- /dev/null +++ b/test/built-ins/Object/prototype/toString/symbol-tag-override.js @@ -0,0 +1,53 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + String values of `Symbol.toStringTag` property override built-in tags +es6id: 19.1.3.6 +info: > + 16. Let tag be Get (O, @@toStringTag). + 17. ReturnIfAbrupt(tag). + 18. If Type(tag) is not String, let tag be builtinTag. + 19. Return the String that is the result of concatenating "[object ", tag, + and "]". +features: [Symbol.toStringTag] +---*/ + +var custom; + +custom = []; +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = new String(); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = (function() { return arguments; }()); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = function() {}; +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = new Error(); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = new Boolean(); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = new Number(); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = new Date(); +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); + +custom = /./; +custom[Symbol.toStringTag] = 'test262'; +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); diff --git a/test/built-ins/Object/prototype/toString/symbol-tag-str.js b/test/built-ins/Object/prototype/toString/symbol-tag-str.js new file mode 100644 index 0000000000..ec7191c02f --- /dev/null +++ b/test/built-ins/Object/prototype/toString/symbol-tag-str.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + String values of `Symbol.toStringTag` property are honored +es6id: 19.1.3.6 +info: > + 16. Let tag be Get (O, @@toStringTag). + 17. ReturnIfAbrupt(tag). + 18. If Type(tag) is not String, let tag be builtinTag. + 19. Return the String that is the result of concatenating "[object ", tag, + and "]". +features: [Symbol.toStringTag] +---*/ + +var custom = {}; +custom[Symbol.toStringTag] = 'test262'; + +assert.sameValue(Object.prototype.toString.call(custom), '[object test262]'); diff --git a/test/built-ins/Promise/prototype/Symbol.toStringTag.js b/test/built-ins/Promise/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..96d5f23c4f --- /dev/null +++ b/test/built-ins/Promise/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.4.5.4 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Promise". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Promise.prototype[Symbol.toStringTag], 'Promise'); + +verifyNotEnumerable(Promise.prototype, Symbol.toStringTag); +verifyNotWritable(Promise.prototype, Symbol.toStringTag); +verifyConfigurable(Promise.prototype, Symbol.toStringTag); diff --git a/test/built-ins/Set/prototype/Symbol.toStringTag.js b/test/built-ins/Set/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..a9e5850fd2 --- /dev/null +++ b/test/built-ins/Set/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.2.3.12 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Set". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Set.prototype[Symbol.toStringTag], 'Set'); + +verifyNotEnumerable(Set.prototype, Symbol.toStringTag); +verifyNotWritable(Set.prototype, Symbol.toStringTag); +verifyConfigurable(Set.prototype, Symbol.toStringTag); diff --git a/test/built-ins/SetIteratorPrototype/Symbol.toStringTag.js b/test/built-ins/SetIteratorPrototype/Symbol.toStringTag.js index 83a389f86f..ac5c54812a 100644 --- a/test/built-ins/SetIteratorPrototype/Symbol.toStringTag.js +++ b/test/built-ins/SetIteratorPrototype/Symbol.toStringTag.js @@ -1,15 +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. /*--- -es6id: 23.2.3.12 +es6id: 23.2.5.2.2 description: > - `Object.prototype.getOwnPropertyDescriptor` should reflect the value and - writability of the @@toStringTag attribute. + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Set Iterator". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. includes: [propertyHelper.js] features: - Symbol.toStringTag - Symbol.iterator - ---*/ +---*/ var SetIteratorProto = Object.getPrototypeOf(new Set()[Symbol.iterator]()); diff --git a/test/built-ins/StringIteratorPrototype/Symbol.toStringTag.js b/test/built-ins/StringIteratorPrototype/Symbol.toStringTag.js index 43d591a430..98ea785a17 100644 --- a/test/built-ins/StringIteratorPrototype/Symbol.toStringTag.js +++ b/test/built-ins/StringIteratorPrototype/Symbol.toStringTag.js @@ -1,11 +1,16 @@ // Copyright (C) 2014 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 21.1.5.2.1 +es6id: 21.1.5.2.2 description: > + `Symbol.toStringTag` property descriptor +info: > The initial value of the @@toStringTag property is the string value "String - Iterator". This property has the attributes { [[Writable]]: false, - [[Enumerable]]: false, [[Configurable]]: true }. + Iterator". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +features: [Symbol.iterator, Symbol.toStringTag] includes: [propertyHelper.js] ---*/ diff --git a/test/built-ins/Symbol/prototype/@@toStringTag/@@toStringTag.js b/test/built-ins/Symbol/prototype/@@toStringTag/@@toStringTag.js deleted file mode 100644 index 4e90dff435..0000000000 --- a/test/built-ins/Symbol/prototype/@@toStringTag/@@toStringTag.js +++ /dev/null @@ -1,12 +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. -/*--- -es6id: 19.4.3.2 -description: > - toStringTag return value ----*/ -assert.sameValue( - Object.prototype.toString.call(Symbol('66')), - '[object Symbol]', - "`Object.prototype.toString.call(Symbol('66'))` returns `'[object Symbol]'`" -); diff --git a/test/built-ins/Symbol/prototype/Symbol.toStringTag.js b/test/built-ins/Symbol/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..29296ae181 --- /dev/null +++ b/test/built-ins/Symbol/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.3.5 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "Symbol". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(Symbol.prototype[Symbol.toStringTag], 'Symbol'); + +verifyNotEnumerable(Symbol.prototype, Symbol.toStringTag); +verifyNotWritable(Symbol.prototype, Symbol.toStringTag); +verifyConfigurable(Symbol.prototype, Symbol.toStringTag); diff --git a/test/built-ins/Symbol/toStringTag/prop-desc.js b/test/built-ins/Symbol/toStringTag/prop-desc.js new file mode 100644 index 0000000000..f675309dc7 --- /dev/null +++ b/test/built-ins/Symbol/toStringTag/prop-desc.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 19.4.2.13 +description: > + `Symbol.toStringTag` property descriptor +info: > + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: false }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(typeof Symbol.toStringTag, 'symbol'); +verifyNotEnumerable(Symbol, 'toStringTag'); +verifyNotWritable(Symbol, 'toStringTag'); +verifyNotConfigurable(Symbol, 'toStringTag'); diff --git a/test/built-ins/WeakMap/prototype/Symbol.toStringTag.js b/test/built-ins/WeakMap/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..a5fb0227b0 --- /dev/null +++ b/test/built-ins/WeakMap/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.3.3.6 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "WeakMap". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(WeakMap.prototype[Symbol.toStringTag], 'WeakMap'); + +verifyNotEnumerable(WeakMap.prototype, Symbol.toStringTag); +verifyNotWritable(WeakMap.prototype, Symbol.toStringTag); +verifyConfigurable(WeakMap.prototype, Symbol.toStringTag); diff --git a/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js b/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js deleted file mode 100644 index ef26cc6af6..0000000000 --- a/test/built-ins/WeakMap/prototype/Symbol.toStringTag/property-descriptor.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 23.3.3.6 -description: "WeakMap#@@toStringTag value and writability" -info: > - WeakMap.prototype [ @@toStringTag ] - - The initial value of the @@toStringTag property is the String value "WeakMap". - - This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, - [[Configurable]]: true }. -includes: [propertyHelper.js] - ---*/ - -var WeakMapProto = WeakMap.prototype; - -assert.sameValue( - WeakMapProto[Symbol.toStringTag], - 'WeakMap', - 'The value of WeakMap.prototype[Symbol.toStringTag] is "WeakMap"' -); - -verifyNotEnumerable(WeakMapProto, Symbol.toStringTag); -verifyNotWritable(WeakMapProto, Symbol.toStringTag); -verifyConfigurable(WeakMapProto, Symbol.toStringTag); diff --git a/test/built-ins/WeakSet/prototype/Symbol.toStringTag.js b/test/built-ins/WeakSet/prototype/Symbol.toStringTag.js new file mode 100644 index 0000000000..33f9c1eff1 --- /dev/null +++ b/test/built-ins/WeakSet/prototype/Symbol.toStringTag.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 23.4.3.5 +description: > + `Symbol.toStringTag` property descriptor +info: > + The initial value of the @@toStringTag property is the String value + "WeakSet". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: + false, [[Configurable]]: true }. +includes: [propertyHelper.js] +features: [Symbol.toStringTag] +---*/ + +assert.sameValue(WeakSet.prototype[Symbol.toStringTag], 'WeakSet'); + +verifyNotEnumerable(WeakSet.prototype, Symbol.toStringTag); +verifyNotWritable(WeakSet.prototype, Symbol.toStringTag); +verifyConfigurable(WeakSet.prototype, Symbol.toStringTag); diff --git a/test/built-ins/WeakSet/prototype/Symbol.toStringTag/property-descriptor.js b/test/built-ins/WeakSet/prototype/Symbol.toStringTag/property-descriptor.js deleted file mode 100644 index 22637245d7..0000000000 --- a/test/built-ins/WeakSet/prototype/Symbol.toStringTag/property-descriptor.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 23.4.3.5 -description: "WeakSet#@@toStringTag value and writability" -info: > - 23.4.3.5 WeakSet.prototype [ @@toStringTag ] - - The initial value of the @@toStringTag property is the string value - "WeakSet". - - This property has the attributes { [[Writable]]: false, [[Enumerable]]: - false, [[Configurable]]: true }. -includes: [propertyHelper.js] - ---*/ - -var WeakSetProto = WeakSet.prototype; - -assert.sameValue( - WeakSetProto[Symbol.toStringTag], - 'WeakSet', - 'The value of WeakSet.prototype[Symbol.toStringTag] is "WeakSet"' -); - -verifyNotEnumerable(WeakSetProto, Symbol.toStringTag); -verifyNotWritable(WeakSetProto, Symbol.toStringTag); -verifyConfigurable(WeakSetProto, Symbol.toStringTag);