mirror of https://github.com/tc39/test262.git
BigInt: additional info frontmatter. Validated features (#1518)
This commit is contained in:
parent
a1a4e2b1b8
commit
cd6305155b
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
function err() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.sameValue(BigInt.asIntN(2, Object(0n)), 0n, "ToPrimitive: unbox object with internal slot");
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
function err() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asIntN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.sameValue(BigInt.asIntN(Object(0), 1n), 0n, "ToPrimitive: unbox object with internal slot");
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
function err() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
2. Let bigint ? ToBigInt(bigint).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.sameValue(BigInt.asUintN(2, Object(0n)), 0n, "ToPrimitive: unbox object with internal slot");
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.throws(RangeError, function() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
function err() {
|
||||
|
|
|
@ -7,7 +7,7 @@ info: |
|
|||
BigInt.asUintN ( bits, bigint )
|
||||
|
||||
1. Let bits be ? ToIndex(bits).
|
||||
features: [BigInt, Symbol.toPrimitive, computed-property-names]
|
||||
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
assert.sameValue(BigInt.asUintN(Object(0), 1n), 0n, "ToPrimitive: unbox object with internal slot");
|
||||
|
|
|
@ -5,9 +5,17 @@
|
|||
description: Empty String should in BigInt should result into 0n
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
EDITOR'S NOTE StringToBigInt("") is 0n according to the logic in 3.1.3.1.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -5,10 +5,17 @@
|
|||
description: String should be parsed to BigInt according StringToBigInt
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -5,10 +5,17 @@
|
|||
description: String should be parsed to BigInt according StringToBigInt
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -5,10 +5,17 @@
|
|||
description: Hexdecimal prefixed String should be parsed to BigInt according StringToBigInt
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -5,10 +5,17 @@
|
|||
description: Octal prefixed String should be parsed to BigInt according StringToBigInt
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -5,10 +5,17 @@
|
|||
description: Invalid String into BigInt constructor should throw SyntaxError
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
description: BigInt constructor called with integer argument
|
||||
esid: sec-bigint-constructor
|
||||
esid: sec-bigint-constructor-number-value
|
||||
info: |
|
||||
BigInt ( value )
|
||||
|
||||
|
@ -17,15 +17,20 @@ info: |
|
|||
features: [BigInt]
|
||||
---*/
|
||||
|
||||
assert.sameValue(BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n);
|
||||
assert.sameValue(
|
||||
BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n,
|
||||
"BigInt(Number.MAX_SAFE_INTEGER) === 9007199254740991n"
|
||||
);
|
||||
|
||||
assert.sameValue(BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n);
|
||||
assert.sameValue(
|
||||
BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n,
|
||||
"BigInt(-Number.MAX_SAFE_INTEGER) === -9007199254740991n"
|
||||
);
|
||||
|
||||
var pos = Math.pow(2, 53);
|
||||
var neg = -pos;
|
||||
assert.throws(RangeError, function() {
|
||||
BigInt(Number.MAX_SAFE_INTEGER + 1);
|
||||
}, "BigInt(Number.MAX_SAFE_INTEGER + 1) throws RangeError");
|
||||
|
||||
assert.sameValue(BigInt(pos), 9007199254740992n,
|
||||
"BigInt(2**53) === 9007199254740992n");
|
||||
|
||||
assert.sameValue(BigInt(neg), -9007199254740992n,
|
||||
"BigInt(2**53) === -9007199254740992n");
|
||||
assert.throws(RangeError, function() {
|
||||
BigInt(-Number.MAX_SAFE_INTEGER - 1);
|
||||
}, "BigInt(-Number.MAX_SAFE_INTEGER - 1) throws RangeError");
|
||||
|
|
|
@ -2,13 +2,21 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Tariling/Leading spaces should be ignored in BigInt constructor should
|
||||
description: Trailing/Leading spaces should be ignored in BigInt constructor
|
||||
esid: sec-string-to-bigint
|
||||
info: |
|
||||
Apply the algorithm in 3.1.3.1 with the following changes:
|
||||
ToBigInt ( argument )
|
||||
|
||||
String:
|
||||
|
||||
Let n be StringToBigInt(prim).
|
||||
If n is NaN, throw a SyntaxError exception.
|
||||
Return n.
|
||||
|
||||
StringToBigInt ( argument )
|
||||
|
||||
Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
|
||||
|
||||
- Replace the StrUnsignedDecimalLiteral production with DecimalDigits
|
||||
to not allow decimal points or exponents.
|
||||
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
|
|
@ -11,7 +11,7 @@ info: |
|
|||
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||
false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol.toStringTag, BigInt, Symbol]
|
||||
features: [BigInt, Symbol, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
verifyProperty(BigInt.prototype, Symbol.toStringTag, {
|
||||
|
|
|
@ -16,7 +16,7 @@ info: |
|
|||
2. If Type(value) is Object and value has a [[BigIntData]] internal slot, then
|
||||
...
|
||||
3. Throw a TypeError exception.
|
||||
features: [BigInt, Symbol.toPrimitive]
|
||||
features: [BigInt, Symbol, Symbol.toPrimitive]
|
||||
---*/
|
||||
|
||||
var toString = BigInt.prototype.toString;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Throws exception in BigIntConstructor if valueOf/toString does that
|
||||
description: Throws exception in BigIntConstructor if toString throws
|
||||
esid: sec-bigint-constructor-number-value
|
||||
info: |
|
||||
1. If NewTarget is not undefined, throw a TypeError exception.
|
||||
|
@ -12,14 +12,6 @@ info: |
|
|||
features: [BigInt]
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
BigInt({
|
||||
valueOf: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
BigInt({
|
||||
toString: function() {
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2017 Caio Lima. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Throws exception in BigIntConstructor if valueOf throws
|
||||
esid: sec-bigint-constructor-number-value
|
||||
info: |
|
||||
1. If NewTarget is not undefined, throw a TypeError exception.
|
||||
2. Let prim be ? ToPrimitive(value, hint Number).
|
||||
3. If Type(prim) is Number, return ? NumberToBigInt(prim).
|
||||
4. Otherwise, return ? ToBigInt(value).
|
||||
features: [BigInt]
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
BigInt({
|
||||
valueOf: function() {
|
||||
throw new Test262Error();
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue