BigInt: Add test for BigInt.prototype[Symbol.toStringTag]

Tests the fix for https://github.com/tc39/proposal-bigint/issues/92
This commit is contained in:
Daniel Ehrenberg 2017-10-26 15:06:46 +02:00
parent a456b0a390
commit d88d1fb2dd
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)));