diff options
Diffstat (limited to 'js/src/tests/test262/language/literals/bigint')
63 files changed, 2408 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/literals/bigint/binary-invalid-digit.js b/js/src/tests/test262/language/literals/bigint/binary-invalid-digit.js new file mode 100644 index 0000000000..475bdde372 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/binary-invalid-digit.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Binary BigInt literal containing an invalid digit +esid: prod-NumericLiteral +info: | + NumericLiteral :: + NumericLiteralBase NumericLiteralSuffix + + NumericLiteralBase :: + DecimalLiteral + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + NumericLiteralSuffix :: n +negative: + phase: parse + type: SyntaxError +features: [BigInt] +---*/ + +$DONOTEVALUATE(); + +0b2n; diff --git a/js/src/tests/test262/language/literals/bigint/browser.js b/js/src/tests/test262/language/literals/bigint/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/browser.js diff --git a/js/src/tests/test262/language/literals/bigint/exponent-part.js b/js/src/tests/test262/language/literals/bigint/exponent-part.js new file mode 100644 index 0000000000..f5e945b0c7 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/exponent-part.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + It is a Syntax Error if the NumericLiteralBase contains an ExponentPart. +esid: sec-numeric-literal-static-semantics-early-errors +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0e0n; diff --git a/js/src/tests/test262/language/literals/bigint/hexadecimal-invalid-digit.js b/js/src/tests/test262/language/literals/bigint/hexadecimal-invalid-digit.js new file mode 100644 index 0000000000..5251086874 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/hexadecimal-invalid-digit.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Hexadecimal BigInt literal containing an invalid digit +esid: prod-NumericLiteral +info: | + NumericLiteral :: + NumericLiteralBase NumericLiteralSuffix + + NumericLiteralBase :: + DecimalLiteral + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + NumericLiteralSuffix :: n +negative: + phase: parse + type: SyntaxError +features: [BigInt] +---*/ + +$DONOTEVALUATE(); + +0xgn; diff --git a/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-00n.js b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-00n.js new file mode 100644 index 0000000000..b59313113b --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-00n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in LegacyOctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + LegacyOctalIntegerLiteral + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +00n; diff --git a/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-01n.js b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-01n.js new file mode 100644 index 0000000000..7a47db5856 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-01n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in LegacyOctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + LegacyOctalIntegerLiteral + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +01n; diff --git a/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-07n.js b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-07n.js new file mode 100644 index 0000000000..aa36be30d3 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/legacy-octal-like-invalid-07n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in LegacyOctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + LegacyOctalIntegerLiteral + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +07n; diff --git a/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dil-dot-dds.js b/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dil-dot-dds.js new file mode 100644 index 0000000000..0531675baf --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dil-dot-dds.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-numeric-literal-static-semantics-early-errors +description: > + It is a Syntax Error if the MV is not an integer. (decimalIntegerLiteral dot decimalDigits) +info: | + Static Semantics: BigInt Value + + NumericLiteral :: NumericLiteralBase NumericLiteralSuffix + + 1. Assert: NumericLiteralSuffix is n. + 2. Let the value of NumericLiteral be the MV of NumericLiteralBase represented as BigInt. + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt + . DecimalDigits +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +2017.8n; diff --git a/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dot-dds.js b/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dot-dds.js new file mode 100644 index 0000000000..c276b4249c --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/mv-is-not-integer-dot-dds.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-numeric-literal-static-semantics-early-errors +description: > + It is a Syntax Error if the MV is not an integer. (dot decimalDigits) +info: | + Static Semantics: BigInt Value + + NumericLiteral :: NumericLiteralBase NumericLiteralSuffix + + 1. Assert: NumericLiteralSuffix is n. + 2. Let the value of NumericLiteral be the MV of NumericLiteralBase represented as BigInt. + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt + . DecimalDigits +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +.0000000001n; diff --git a/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-0008n.js b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-0008n.js new file mode 100644 index 0000000000..a624cc5abb --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-0008n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in NonOctalDecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + + https://github.com/tc39/proposal-bigint/issues/208 + + NumericLiteral :: + DecimalBigIntegerLiteral + + DecimalBigIntegerLiteral :: + 0 BigIntLiteralSuffix + NonZeroDigit DecimalDigits_opt BigIntLiteralSuffix +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0008n; diff --git a/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-012348n.js b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-012348n.js new file mode 100644 index 0000000000..c98d65cfc0 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-012348n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in NonOctalDecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + + https://github.com/tc39/proposal-bigint/issues/208 + + NumericLiteral :: + DecimalBigIntegerLiteral + + DecimalBigIntegerLiteral :: + 0 BigIntLiteralSuffix + NonZeroDigit DecimalDigits_opt BigIntLiteralSuffix +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +012348n; diff --git a/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-08n.js b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-08n.js new file mode 100644 index 0000000000..edea3cc0d6 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-08n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in NonOctalDecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + + https://github.com/tc39/proposal-bigint/issues/208 + + NumericLiteral :: + DecimalBigIntegerLiteral + + DecimalBigIntegerLiteral :: + 0 BigIntLiteralSuffix + NonZeroDigit DecimalDigits_opt BigIntLiteralSuffix +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +08n; diff --git a/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-09n.js b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-09n.js new file mode 100644 index 0000000000..ab537a83ea --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/non-octal-like-invalid-09n.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteral +description: > + The BigInt suffix is disallowed in NonOctalDecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + + https://github.com/tc39/proposal-bigint/issues/208 + + NumericLiteral :: + DecimalBigIntegerLiteral + + DecimalBigIntegerLiteral :: + 0 BigIntLiteralSuffix + NonZeroDigit DecimalDigits_opt BigIntLiteralSuffix +features: [BigInt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +09n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/browser.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/browser.js diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js new file mode 100644 index 0000000000..350b8cec10 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0b` | `0B` in a + BinaryIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b_1n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js new file mode 100644 index 0000000000..b0b51ccfca --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0b0_1n, 0b01n); +assert.sameValue(0B0_1n, 0B01n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js new file mode 100644 index 0000000000..1419a21c55 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0b` | `0B` BinaryDigit NumericLiteralSeparator BinaryDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0b0_10n, 0b010n); +assert.sameValue(0B0_10n, 0B010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js new file mode 100644 index 0000000000..9169b37d4b --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0b01_0n, 0b010n); +assert.sameValue(0B01_0n, 0B010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js new file mode 100644 index 0000000000..810de95606 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0b` | `0B` BinaryDigits NumericLiteralSeparator BinaryDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0b01_00n, 0b0100n); +assert.sameValue(0B01_00n, 0B0100n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js new file mode 100644 index 0000000000..f7b39f745e --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a BinaryIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b0__0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js new file mode 100644 index 0000000000..b1e010bee2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + BinaryIntegerLiteral (before n) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b0_n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js new file mode 100644 index 0000000000..722fc928e4 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js @@ -0,0 +1,48 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + + DecimalDigits :: + DecimalDigit + ... + + DecimalDigit :: one of + 0 1 2 3 4 5 6 7 8 9 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(1_0n, 10n); +assert.sameValue(1_1n, 11n); +assert.sameValue(1_2n, 12n); +assert.sameValue(1_3n, 13n); +assert.sameValue(1_4n, 14n); +assert.sameValue(1_5n, 15n); +assert.sameValue(1_6n, 16n); +assert.sameValue(1_7n, 17n); +assert.sameValue(1_8n, 18n); +assert.sameValue(1_9n, 19n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..39c50502c0 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a DecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1__0123456789n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-err.js new file mode 100644 index 0000000000..77b8b16762 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dd-nsl-err.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1_n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dd.js new file mode 100644 index 0000000000..b512d91c85 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dd.js @@ -0,0 +1,40 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: DecimalDigits NumericLiteralSeparator DecimalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(123456789_0n, 1234567890n); +assert.sameValue(123456789_1n, 1234567891n); +assert.sameValue(123456789_2n, 1234567892n); +assert.sameValue(123456789_3n, 1234567893n); +assert.sameValue(123456789_4n, 1234567894n); +assert.sameValue(123456789_5n, 1234567895n); +assert.sameValue(123456789_6n, 1234567896n); +assert.sameValue(123456789_7n, 1234567897n); +assert.sameValue(123456789_8n, 1234567898n); +assert.sameValue(123456789_9n, 1234567899n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..cd076969b4 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in DecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10__0123456789n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-err.js new file mode 100644 index 0000000000..c0e21c2942 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-dds-nsl-err.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + DecimalLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10_n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js new file mode 100644 index 0000000000..4c4b465f6c --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0x` | `0X` in a + HexIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x_1n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js new file mode 100644 index 0000000000..c3945e86ed --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0x` | `0X` HexDigit NumericLiteralSeparator HexDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0x0_1n, 0x01n); +assert.sameValue(0X0_1n, 0X01n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js new file mode 100644 index 0000000000..1e826d008f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0x` | `0X` HexDigit NumericLiteralSeparator HexDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0x0_10n, 0x010n); +assert.sameValue(0X0_10n, 0X010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js new file mode 100644 index 0000000000..8507b65bf2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0x` | `0X` HexDigits NumericLiteralSeparator HexDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0x01_0n, 0x010n); +assert.sameValue(0X01_0n, 0X010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js new file mode 100644 index 0000000000..e9c821ebb5 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0x` | `0X` HexDigits NumericLiteralSeparator HexDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0x01_00n, 0x0100n); +assert.sameValue(0X01_00n, 0X0100n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js new file mode 100644 index 0000000000..d580d210f9 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a HexIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x0__0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js new file mode 100644 index 0000000000..5d6620f17f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + HexIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x0_n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js new file mode 100644 index 0000000000..04a64ae76f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js @@ -0,0 +1,61 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0x` | `0X` HexDigit NumericLiteralSeparator HexDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + HexIntegerLiteral :: + 0x HexDigits + 0X HexDigits + + HexDigits :: + HexDigit + HexDigits HexDigit + HexDigits NumericLiteralSeparator HexDigit + + HexDigit::one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0x0_0n, 0x00n); +assert.sameValue(0x1_1n, 0x11n); +assert.sameValue(0x2_2n, 0x22n); +assert.sameValue(0x3_3n, 0x33n); +assert.sameValue(0x4_4n, 0x44n); +assert.sameValue(0x5_5n, 0x55n); +assert.sameValue(0x6_6n, 0x66n); +assert.sameValue(0x7_7n, 0x77n); +assert.sameValue(0x8_8n, 0x88n); +assert.sameValue(0x9_9n, 0x99n); +assert.sameValue(0xa_a, 0xaa); +assert.sameValue(0xb_b, 0xbb); +assert.sameValue(0xc_c, 0xcc); +assert.sameValue(0xd_d, 0xdd); +assert.sameValue(0xe_e, 0xee); +assert.sameValue(0xf_f, 0xff); +assert.sameValue(0xA_A, 0xAA); +assert.sameValue(0xB_B, 0xBB); +assert.sameValue(0xC_C, 0xCC); +assert.sameValue(0xD_D, 0xDD); +assert.sameValue(0xE_E, 0xEE); +assert.sameValue(0xF_F, 0xFF); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-00-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-00-err.js new file mode 100644 index 0000000000..b61a24236a --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-00-err.js @@ -0,0 +1,53 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (00_0) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +00_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-01-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-01-err.js new file mode 100644 index 0000000000..58550944d0 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-01-err.js @@ -0,0 +1,53 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (01_0) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +01_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-07-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-07-err.js new file mode 100644 index 0000000000..2a804378a9 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-07-err.js @@ -0,0 +1,55 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (07_0) + ) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +07_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_0-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_0-err.js new file mode 100644 index 0000000000..10674aa5e7 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_0-err.js @@ -0,0 +1,53 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (0_0) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_1-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_1-err.js new file mode 100644 index 0000000000..47643b10f9 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_1-err.js @@ -0,0 +1,53 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (0_1) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_1n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_7-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_7-err.js new file mode 100644 index 0000000000..ddbaf34629 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-lol-0_7-err.js @@ -0,0 +1,54 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a LegacyOctalLikeDecimalIntegerLiteral (0_7) + ) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 + + OctalDigit::one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_7n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-08-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-08-err.js new file mode 100644 index 0000000000..8cfa8139c9 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-08-err.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a NonOctalDecimalIntegerLiteral (08) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +08_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-09-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-09-err.js new file mode 100644 index 0000000000..573d8e64f8 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-09-err.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a NonOctalDecimalIntegerLiteral (09) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +09_0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_8-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_8-err.js new file mode 100644 index 0000000000..7bd186514f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_8-err.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a NonOctalDecimalIntegerLiteral (0_8) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_8n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_9-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_9-err.js new file mode 100644 index 0000000000..be0f250238 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nonoctal-0_9-err.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator must not be in a NonOctalDecimalIntegerLiteral (0_9) +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigitsopt + NonZeroDigit + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit::one of + 8 9 +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_9n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js new file mode 100644 index 0000000000..9b3337e8e5 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + + DecimalDigits :: + DecimalDigit + ... + + DecimalDigit :: one of + 0 1 2 3 4 5 6 7 8 9 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(1_0n, 10n); +assert.sameValue(1_1n, 11n); +assert.sameValue(2_2n, 22n); +assert.sameValue(3_3n, 33n); +assert.sameValue(4_4n, 44n); +assert.sameValue(5_5n, 55n); +assert.sameValue(6_6n, 66n); +assert.sameValue(7_7n, 77n); +assert.sameValue(8_8n, 88n); +assert.sameValue(9_9n, 99n); + + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js new file mode 100644 index 0000000000..a3d5f2bc71 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js @@ -0,0 +1,39 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + + DecimalDigits :: + ... + DecimalDigits DecimalDigit + ... + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(1_1n, 11n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..60b78c67af --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in DecimalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0__0123456789n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js new file mode 100644 index 0000000000..751cdcd91f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigits +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_0123456789n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js new file mode 100644 index 0000000000..d300ebaa16 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js @@ -0,0 +1,39 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigits +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + + DecimalDigits :: + ... + DecimalDigits DecimalDigit + ... + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(1_0123456789n, 10123456789n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js new file mode 100644 index 0000000000..e33a07c8b1 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a OctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o0__0n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js new file mode 100644 index 0000000000..b15edd31b0 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of an + OctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o0_n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js new file mode 100644 index 0000000000..c43cd67f31 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0o` | `0O` in a + OctalIntegerLiteral +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o_1n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js new file mode 100644 index 0000000000..7fe2072c1f --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js @@ -0,0 +1,47 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0o0_0n, 0o00n); +assert.sameValue(0o1_1n, 0o11n); +assert.sameValue(0o2_2n, 0o22n); +assert.sameValue(0o3_3n, 0o33n); +assert.sameValue(0o4_4n, 0o44n); +assert.sameValue(0o5_5n, 0o55n); +assert.sameValue(0o6_6n, 0o66n); +assert.sameValue(0o7_7n, 0o77n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js new file mode 100644 index 0000000000..bfc0976795 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0o0_1n, 0o01n); +assert.sameValue(0O0_1n, 0O01n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js new file mode 100644 index 0000000000..77b93b1600 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0o` | `0O` OctalDigit NumericLiteralSeparator OctalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0o0_10n, 0o010n); +assert.sameValue(0O0_10n, 0O010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js new file mode 100644 index 0000000000..04dbdbad04 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0o01_0n, 0o010n); +assert.sameValue(0O01_0n, 0O010n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js new file mode 100644 index 0000000000..87684ea2aa --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js @@ -0,0 +1,41 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `0o` | `0O` OctalDigits NumericLiteralSeparator OctalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigits NumericLiteralSeparator OctalDigit + + OctalDigit :: one of + 0 1 2 3 4 5 6 7 + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(0o01_00n, 0o0100n); +assert.sameValue(0O01_00n, 0O0100n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js new file mode 100644 index 0000000000..f3eabae087 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js @@ -0,0 +1,40 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: DecimalDigits NumericLiteralSeparator DecimalDigit +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator :: + _ + + SignedInteger :: + ... + - DecimalDigits + +features: [BigInt, numeric-separator-literal] +---*/ + +assert.sameValue(-123456789_0n, -1234567890n); +assert.sameValue(-123456789_1n, -1234567891n); +assert.sameValue(-123456789_2n, -1234567892n); +assert.sameValue(-123456789_3n, -1234567893n); +assert.sameValue(-123456789_4n, -1234567894n); +assert.sameValue(-123456789_5n, -1234567895n); +assert.sameValue(-123456789_6n, -1234567896n); +assert.sameValue(-123456789_7n, -1234567897n); +assert.sameValue(-123456789_8n, -1234567898n); +assert.sameValue(-123456789_9n, -1234567899n); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-unicode-err.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-unicode-err.js new file mode 100644 index 0000000000..41e6b43b9d --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/numeric-separator-literal-unicode-err.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + NonZeroDigit NumericLiteralSeparator DecimalDigits sequence expressed with + unicode escape sequence +info: | + NumericLiteral :: + DecimalIntegerLiteral BigIntLiteralSuffix + NumericLiteralBase BigIntLiteralSuffix + + NumericLiteralBase :: + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + BigIntLiteralSuffix :: n + + NumericLiteralSeparator:: + _ + + DecimalIntegerLiteral:: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError +features: [BigInt, numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1\u005F0123456789n; diff --git a/js/src/tests/test262/language/literals/bigint/numeric-separators/shell.js b/js/src/tests/test262/language/literals/bigint/numeric-separators/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/numeric-separators/shell.js diff --git a/js/src/tests/test262/language/literals/bigint/octal-invalid-digit.js b/js/src/tests/test262/language/literals/bigint/octal-invalid-digit.js new file mode 100644 index 0000000000..ac587dbdc2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/octal-invalid-digit.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Octal BigInt literal containing an invalid digit +esid: prod-NumericLiteral +info: | + NumericLiteral :: + NumericLiteralBase NumericLiteralSuffix + + NumericLiteralBase :: + DecimalLiteral + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + + NumericLiteralSuffix :: n +negative: + phase: parse + type: SyntaxError +features: [BigInt] +---*/ + +$DONOTEVALUATE(); + +0o9n; diff --git a/js/src/tests/test262/language/literals/bigint/shell.js b/js/src/tests/test262/language/literals/bigint/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/bigint/shell.js |