mirror of https://github.com/tc39/test262.git
Add tests for well-known Symbol: @@toStringTag
This commit is contained in:
parent
9cb89a4e3c
commit
d6bbbc9aed
|
@ -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);
|
|
@ -2,12 +2,18 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
description: >
|
||||||
`Object.prototype.getOwnPropertyDescriptor` should reflect the value and
|
`Symbol.toStringTag` property descriptor
|
||||||
writability of the @@toStringTag attribute.
|
info: >
|
||||||
includes: [propertyHelper.js]
|
The initial value of the @@toStringTag property is the String value "Array
|
||||||
es6id: 22.1.5.2.2
|
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]());
|
var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]());
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
@ -3,9 +3,16 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
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
|
es6id: 25.2.3.3
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
|
features: [Symbol.toStringTag]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var GeneratorFunctionPrototype = Object.getPrototypeOf(function*() {});
|
var GeneratorFunctionPrototype = Object.getPrototypeOf(function*() {});
|
|
@ -3,9 +3,16 @@
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: >
|
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
|
es6id: 25.3.1.5
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
|
features: [Symbol.toStringTag]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var GeneratorPrototype = Object.getPrototypeOf(
|
var GeneratorPrototype = Object.getPrototypeOf(
|
||||||
|
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
|
@ -3,10 +3,16 @@
|
||||||
/*---
|
/*---
|
||||||
es6id: 23.1.5.2.2
|
es6id: 23.1.5.2.2
|
||||||
description: >
|
description: >
|
||||||
`Object.prototype.getOwnPropertyDescriptor` should reflect the value and
|
`Symbol.toStringTag` property descriptor
|
||||||
writability of the @@toStringTag attribute.
|
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]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
features: [Symbol.iterator, Symbol.toStringTag]
|
||||||
|
---*/
|
||||||
|
|
||||||
var MapIteratorProto = Object.getPrototypeOf(new Map()[Symbol.iterator]());
|
var MapIteratorProto = Object.getPrototypeOf(new Map()[Symbol.iterator]());
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
@ -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();
|
||||||
|
});
|
|
@ -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]');
|
|
@ -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]');
|
|
@ -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]');
|
|
@ -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);
|
|
@ -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);
|
|
@ -1,15 +1,20 @@
|
||||||
// Copyright (C) 2014 the V8 project authors. All rights reserved.
|
// Copyright (C) 2014 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// 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: >
|
description: >
|
||||||
`Object.prototype.getOwnPropertyDescriptor` should reflect the value and
|
`Symbol.toStringTag` property descriptor
|
||||||
writability of the @@toStringTag attribute.
|
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]
|
includes: [propertyHelper.js]
|
||||||
features:
|
features:
|
||||||
- Symbol.toStringTag
|
- Symbol.toStringTag
|
||||||
- Symbol.iterator
|
- Symbol.iterator
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var SetIteratorProto = Object.getPrototypeOf(new Set()[Symbol.iterator]());
|
var SetIteratorProto = Object.getPrototypeOf(new Set()[Symbol.iterator]());
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
// Copyright (C) 2014 the V8 project authors. All rights reserved.
|
// Copyright (C) 2014 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// 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: >
|
description: >
|
||||||
|
`Symbol.toStringTag` property descriptor
|
||||||
|
info: >
|
||||||
The initial value of the @@toStringTag property is the string value "String
|
The initial value of the @@toStringTag property is the string value "String
|
||||||
Iterator". This property has the attributes { [[Writable]]: false,
|
Iterator".
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
|
||||||
|
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||||
|
false, [[Configurable]]: true }.
|
||||||
|
features: [Symbol.iterator, Symbol.toStringTag]
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
|
@ -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]'`"
|
|
||||||
);
|
|
|
@ -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);
|
|
@ -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');
|
|
@ -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);
|
|
@ -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);
|
|
|
@ -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);
|
|
@ -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);
|
|
Loading…
Reference in New Issue