Merge pull request #1320 from littledan/bigint-tostringtag

BigInt: Add test for BigInt.prototype[Symbol.toStringTag]
This commit is contained in:
Rick Waldron 2017-10-27 11:44:19 -04:00 committed by GitHub
commit f1602088e6
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// Copyright (C) 2017 Igalia, S. L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint-@@tostringtag
description: >
`Symbol.toStringTag` property descriptor
info: >
The initial value of the @@toStringTag property is the String value
"BigInt".
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Symbol.toStringTag, BigInt, Symbol]
---*/
verifyProperty(BigInt.prototype, Symbol.toStringTag, {
value: "BigInt",
writable: false,
enumerable: false,
configurable: true
});
assertEquals("[object BigInt]", Object.prototype.toString.call(3n));
assertEquals("[object BigInt]", Object.prototype.toString.call(Object(3n)));
// Verify that Object.prototype.toString does not have special casing for BigInt
// as it does for most other primitive types
Object.defineProperty(BigInt.prototype, {
value: "FooBar",
writable: false,
enumerable: false,
configurable: true
});
assertEquals("[object FooBar]", Object.prototype.toString.call(3n));
assertEquals("[object FooBar]", Object.prototype.toString.call(Object(3n)));