diff options
Diffstat (limited to 'js/src/tests/test262/language/literals')
468 files changed, 15279 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 diff --git a/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T1.js b/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T1.js new file mode 100644 index 0000000000..3884b64de3 --- /dev/null +++ b/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Literal :: BooleanLiteral" +es5id: 7.8.2_A1_T1 +description: "BooleanLiteral :: true" +---*/ + +//CHECK#1 +if (Boolean(true) !== true) { + throw new Test262Error('#1: Boolean(true) === true. Actual: Boolean(true) === ' + (Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T2.js b/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T2.js new file mode 100644 index 0000000000..b772876ff9 --- /dev/null +++ b/js/src/tests/test262/language/literals/boolean/S7.8.2_A1_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Literal :: BooleanLiteral" +es5id: 7.8.2_A1_T2 +description: "BooleanLiteral :: false" +---*/ + +//CHECK#1 +if (Boolean(false) !== false) { + throw new Test262Error('#1: Boolean(false) === false. Actual: Boolean(false) === ' + (Boolean(false))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/boolean/browser.js b/js/src/tests/test262/language/literals/boolean/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/boolean/browser.js diff --git a/js/src/tests/test262/language/literals/boolean/shell.js b/js/src/tests/test262/language/literals/boolean/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/boolean/shell.js diff --git a/js/src/tests/test262/language/literals/browser.js b/js/src/tests/test262/language/literals/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/browser.js diff --git a/js/src/tests/test262/language/literals/null/S7.8.1_A1_T1.js b/js/src/tests/test262/language/literals/null/S7.8.1_A1_T1.js new file mode 100644 index 0000000000..cafe52788e --- /dev/null +++ b/js/src/tests/test262/language/literals/null/S7.8.1_A1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Literal :: NullLiteral" +es5id: 7.8.1_A1_T1 +description: Check null === null +---*/ + +//CHECK#1 +if (null !== null) { + throw new Test262Error('#1: null === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/null/S7.8.1_A1_T2.js b/js/src/tests/test262/language/literals/null/S7.8.1_A1_T2.js new file mode 100644 index 0000000000..50216edf77 --- /dev/null +++ b/js/src/tests/test262/language/literals/null/S7.8.1_A1_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Literal :: NullLiteral" +es5id: 7.8.1_A1_T2 +description: Check RegExp("0").exec("1") === null +---*/ + +//CHECK#1 +if (RegExp("0").exec("1") !== null) { + throw new Test262Error('#1: RegExp("0").exec("1") === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/null/browser.js b/js/src/tests/test262/language/literals/null/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/null/browser.js diff --git a/js/src/tests/test262/language/literals/null/shell.js b/js/src/tests/test262/language/literals/null/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/null/shell.js diff --git a/js/src/tests/test262/language/literals/numeric/7.8.3-1gs-strict.js b/js/src/tests/test262/language/literals/numeric/7.8.3-1gs-strict.js new file mode 100644 index 0000000000..9c5671cc7e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/7.8.3-1gs-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-1gs +description: Strict Mode - octal extension(010) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +var y = 010; diff --git a/js/src/tests/test262/language/literals/numeric/7.8.3-2gs-strict.js b/js/src/tests/test262/language/literals/numeric/7.8.3-2gs-strict.js new file mode 100644 index 0000000000..dfb364fb41 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/7.8.3-2gs-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-2gs +description: > + Strict Mode - octal extension is forbidden in strict mode (after a + hex number is assigned to a variable) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +var a; +a = 0x1; +a = 01; diff --git a/js/src/tests/test262/language/literals/numeric/7.8.3-3gs-strict.js b/js/src/tests/test262/language/literals/numeric/7.8.3-3gs-strict.js new file mode 100644 index 0000000000..36cb6278ae --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/7.8.3-3gs-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-3gs +description: > + Strict Mode - octal extension is forbidden in strict mode (after a + hex number is assigned to a variable from an eval) +flags: [onlyStrict] +---*/ + +var a; +assert.throws(SyntaxError, function() { + eval("a = 0x1;a = 01;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T1.js new file mode 100644 index 0000000000..65b517d786 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral" +es5id: 7.8.3_A1.1_T1 +description: "DecimalIntegerLiteral :: 0, NoNZeroDigit" +---*/ + +//CHECK#0 +if (0 !== 0) { + throw new Test262Error('#0: 0 === 0'); +} + +//CHECK#1 +if (1 !== 1) { + throw new Test262Error('#1: 1 === 1'); +} + +//CHECK#2 +if (2 !== 2) { + throw new Test262Error('#2: 2 === 2'); +} + +//CHECK#3 +if (3 !== 3) { + throw new Test262Error('#3: 3 === 3'); +} + +//CHECK#4 +if (4 !== 4) { + throw new Test262Error('#4: 4 === 4'); +} + +//CHECK#5 +if (5 !== 5) { + throw new Test262Error('#5: 5 === 5'); +} + +//CHECK#6 +if (6 !== 6) { + throw new Test262Error('#6: 6 === 6'); +} + +//CHECK#7 +if (7 !== 7) { + throw new Test262Error('#7: 7 === 7'); +} + +//CHECK#8 +if (8 !== 8) { + throw new Test262Error('#8: 8 === 8'); +} + +//CHECK#9 +if (9 !== 9) { + throw new Test262Error('#9: 9 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T2.js new file mode 100644 index 0000000000..3d5c404867 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral" +es5id: 7.8.3_A1.1_T2 +description: "DecimalIntegerLiteral :: NoNZeroDigit DecimalDigits" +---*/ + +//CHECK#1 +if (11 !== 11) { + throw new Test262Error('#1: 11 === 11'); +} + +//CHECK#2 +if (22 !== 22) { + throw new Test262Error('#2: 22 === 22'); +} + +//CHECK#3 +if (33 !== 33) { + throw new Test262Error('#3: 33 === 33'); +} + +//CHECK#4 +if (44 !== 44) { + throw new Test262Error('#4: 44 === 44'); +} + +//CHECK#5 +if (55 !== 55) { + throw new Test262Error('#5: 55 === 55'); +} + +//CHECK#6 +if (66 !== 66) { + throw new Test262Error('#6: 66 === 66'); +} + +//CHECK#7 +if (77 !== 77) { + throw new Test262Error('#7: 77 === 77'); +} + +//CHECK#8 +if (88 !== 88) { + throw new Test262Error('#8: 88 === 88'); +} + +//CHECK#9 +if (99 !== 99) { + throw new Test262Error('#9: 99 === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T1.js new file mode 100644 index 0000000000..985682c62b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T1 +description: "ExponentPart :: e DecimalDigits" +---*/ + +//CHECK#0 +if (0e1 !== 0) { + throw new Test262Error('#0: 0e1 === 0'); +} + +//CHECK#1 +if (1e1 !== 10) { + throw new Test262Error('#1: 1e1 === 10'); +} + +//CHECK#2 +if (2e1 !== 20) { + throw new Test262Error('#2: 2e1 === 20'); +} + +//CHECK#3 +if (3e1 !== 30) { + throw new Test262Error('#3: 3e1 === 30'); +} + +//CHECK#4 +if (4e1 !== 40) { + throw new Test262Error('#4: 4e1 === 40'); +} + +//CHECK#5 +if (5e1 !== 50) { + throw new Test262Error('#5: 5e1 === 50'); +} + +//CHECK#6 +if (6e1 !== 60) { + throw new Test262Error('#6: 6e1 === 60'); +} + +//CHECK#7 +if (7e1 !== 70) { + throw new Test262Error('#7: 7e1 === 70'); +} + +//CHECK#8 +if (8e1 !== 80) { + throw new Test262Error('#8: 8e1 === 80'); +} + +//CHECK#9 +if (9e1 !== 90) { + throw new Test262Error('#9: 9e1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T2.js new file mode 100644 index 0000000000..4c06951f87 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T2 +description: "ExponentPart :: E DecimalDigits" +---*/ + +//CHECK#0 +if (0E1 !== 0) { + throw new Test262Error('#0: 0E1 === 0'); +} + +//CHECK#1 +if (1E1 !== 10) { + throw new Test262Error('#1: 1E1 === 1'); +} + +//CHECK#2 +if (2E1 !== 20) { + throw new Test262Error('#2: 2E1 === 20'); +} + +//CHECK#3 +if (3E1 !== 30) { + throw new Test262Error('#3: 3E1 === 30'); +} + +//CHECK#4 +if (4E1 !== 40) { + throw new Test262Error('#4: 4E1 === 40'); +} + +//CHECK#5 +if (5E1 !== 50) { + throw new Test262Error('#5: 5E1 === 50'); +} + +//CHECK#6 +if (6E1 !== 60) { + throw new Test262Error('#6: 6E1 === 60'); +} + +//CHECK#7 +if (7E1 !== 70) { + throw new Test262Error('#7: 7E1 === 70'); +} + +//CHECK#8 +if (8E1 !== 80) { + throw new Test262Error('#8: 8E1 === 80'); +} + +//CHECK#9 +if (9E1 !== 90) { + throw new Test262Error('#9: 9E1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T3.js new file mode 100644 index 0000000000..643666e171 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T3 +description: "ExponentPart :: e -DecimalDigits" +---*/ + +//CHECK#0 +if (0e-1 !== 0) { + throw new Test262Error('#0: 0e-1 === 0'); +} + +//CHECK#1 +if (1e-1 !== 0.1) { + throw new Test262Error('#1: 1e-1 === 0.1'); +} + +//CHECK#2 +if (2e-1 !== 0.2) { + throw new Test262Error('#2: 2e-1 === 0.2'); +} + +//CHECK#3 +if (3e-1 !== 0.3) { + throw new Test262Error('#3: 3e-1 === 0.3'); +} + +//CHECK#4 +if (4e-1 !== 0.4) { + throw new Test262Error('#4: 4e-1 === 0.4'); +} + +//CHECK#5 +if (5e-1 !== 0.5) { + throw new Test262Error('#5: 5e-1 === 0.5'); +} + +//CHECK#6 +if (6e-1 !== 0.6) { + throw new Test262Error('#6: 6e-1 === 0.6'); +} + +//CHECK#7 +if (7e-1 !== 0.7) { + throw new Test262Error('#7: 7e-1 === 0.7'); +} + +//CHECK#8 +if (8e-1 !== 0.8) { + throw new Test262Error('#8: 8e-1 === 0.8'); +} + +//CHECK#9 +if (9e-1 !== 0.9) { + throw new Test262Error('#9: 9e-1 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T4.js new file mode 100644 index 0000000000..34a32c2110 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T4 +description: "ExponentPart :: E -DecimalDigits" +---*/ + +//CHECK#0 +if (0E-1 !== 0) { + throw new Test262Error('#0: 0E-1 === 0'); +} + +//CHECK#1 +if (1E-1 !== 0.1) { + throw new Test262Error('#1: 1E-1 === 0.1'); +} + +//CHECK#2 +if (2E-1 !== 0.2) { + throw new Test262Error('#2: 2E-1 === 0.2'); +} + +//CHECK#3 +if (3E-1 !== 0.3) { + throw new Test262Error('#3: 3E-1 === 0.3'); +} + +//CHECK#4 +if (4E-1 !== 0.4) { + throw new Test262Error('#4: 4E-1 === 0.4'); +} + +//CHECK#5 +if (5E-1 !== 0.5) { + throw new Test262Error('#5: 5E-1 === 0.5'); +} + +//CHECK#6 +if (6E-1 !== 0.6) { + throw new Test262Error('#6: 6E-1 === 0.6'); +} + +//CHECK#7 +if (7E-1 !== 0.7) { + throw new Test262Error('#7: 7E-1 === 0.7'); +} + +//CHECK#8 +if (8E-1 !== 0.8) { + throw new Test262Error('#8: 8E-1 === 0.8'); +} + +//CHECK#9 +if (9E-1 !== 0.9) { + throw new Test262Error('#9: 9E-1 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T5.js new file mode 100644 index 0000000000..4cbffa4890 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T5 +description: "ExponentPart :: e +DecimalDigits" +---*/ + +//CHECK#0 +if (0e+1 !== 0) { + throw new Test262Error('#0: 0e+1 === 0'); +} + +//CHe+CK#1 +if (1e+1 !== 10) { + throw new Test262Error('#1: 1e+1 === 10'); +} + +//CHe+CK#2 +if (2e+1 !== 20) { + throw new Test262Error('#2: 2e+1 === 20'); +} + +//CHe+CK#3 +if (3e+1 !== 30) { + throw new Test262Error('#3: 3e+1 === 30'); +} + +//CHe+CK#4 +if (4e+1 !== 40) { + throw new Test262Error('#4: 4e+1 === 40'); +} + +//CHe+CK#5 +if (5e+1 !== 50) { + throw new Test262Error('#5: 5e+1 === 50'); +} + +//CHe+CK#6 +if (6e+1 !== 60) { + throw new Test262Error('#6: 6e+1 === 60'); +} + +//CHe+CK#7 +if (7e+1 !== 70) { + throw new Test262Error('#7: 7e+1 === 70'); +} + +//CHe+CK#8 +if (8e+1 !== 80) { + throw new Test262Error('#8: 8e+1 === 80'); +} + +//CHe+CK#9 +if (9e+1 !== 90) { + throw new Test262Error('#9: 9e+1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T6.js new file mode 100644 index 0000000000..c79dd26fbc --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T6.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T6 +description: "ExponentPart :: E +DecimalDigits" +---*/ + +//CHECK#0 +if (0E+1 !== 0) { + throw new Test262Error('#0: 0E+1 === 0'); +} + +//CHE+CK#1 +if (1E+1 !== 10) { + throw new Test262Error('#1: 1E+1 === 10'); +} + +//CHE+CK#2 +if (2E+1 !== 20) { + throw new Test262Error('#2: 2E+1 === 20'); +} + +//CHE+CK#3 +if (3E+1 !== 30) { + throw new Test262Error('#3: 3E+1 === 30'); +} + +//CHE+CK#4 +if (4E+1 !== 40) { + throw new Test262Error('#4: 4E+1 === 40'); +} + +//CHE+CK#5 +if (5E+1 !== 50) { + throw new Test262Error('#5: 5E+1 === 50'); +} + +//CHE+CK#6 +if (6E+1 !== 60) { + throw new Test262Error('#6: 6E+1 === 60'); +} + +//CHE+CK#7 +if (7E+1 !== 70) { + throw new Test262Error('#7: 7E+1 === 70'); +} + +//CHE+CK#8 +if (8E+1 !== 80) { + throw new Test262Error('#8: 8E+1 === 80'); +} + +//CHE+CK#9 +if (9E+1 !== 90) { + throw new Test262Error('#9: 9E+1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T7.js new file mode 100644 index 0000000000..076e396a7f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T7 +description: "ExponentPart :: e 0" +---*/ + +//CHECK#0 +if (0e0 !== 0) { + throw new Test262Error('#0: 0e0 === 0'); +} + +//CHECK#1 +if (1e0 !== 1) { + throw new Test262Error('#1: 1e0 === 1'); +} + +//CHECK#2 +if (2e0 !== 2) { + throw new Test262Error('#2: 2e0 === 2'); +} + +//CHECK#3 +if (3e0 !== 3) { + throw new Test262Error('#3: 3e0 === 3'); +} + +//CHECK#4 +if (4e0 !== 4) { + throw new Test262Error('#4: 4e0 === 4'); +} + +//CHECK#5 +if (5e0 !== 5) { + throw new Test262Error('#5: 5e0 === 5'); +} + +//CHECK#6 +if (6e0 !== 6) { + throw new Test262Error('#6: 6e0 === 6'); +} + +//CHECK#7 +if (7e0 !== 7) { + throw new Test262Error('#7: 7e0 === 7'); +} + +//CHECK#8 +if (8e0 !== 8) { + throw new Test262Error('#8: 8e0 === 8'); +} + +//CHECK#9 +if (9e0 !== 9) { + throw new Test262Error('#9: 9e0 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T8.js new file mode 100644 index 0000000000..cd051db657 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A1.2_T8.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral ExponentPart" +es5id: 7.8.3_A1.2_T8 +description: "ExponentPart :: E 0" +---*/ + +//CHECK#0 +if (0E0 !== 0) { + throw new Test262Error('#0: 0E0 === 0'); +} + +//CHECK#1 +if (1E0 !== 1) { + throw new Test262Error('#1: 1E0 === 1'); +} + +//CHECK#2 +if (2E0 !== 2) { + throw new Test262Error('#2: 2E0 === 2'); +} + +//CHECK#3 +if (3E0 !== 3) { + throw new Test262Error('#3: 3E0 === 3'); +} + +//CHECK#4 +if (4E0 !== 4) { + throw new Test262Error('#4: 4E0 === 4'); +} + +//CHECK#5 +if (5E0 !== 5) { + throw new Test262Error('#5: 5E0 === 5'); +} + +//CHECK#6 +if (6E0 !== 6) { + throw new Test262Error('#6: 6E0 === 6'); +} + +//CHECK#7 +if (7E0 !== 7) { + throw new Test262Error('#7: 7E0 === 7'); +} + +//CHECK#8 +if (8E0 !== 8) { + throw new Test262Error('#8: 8E0 === 8'); +} + +//CHECK#9 +if (9E0 !== 9) { + throw new Test262Error('#9: 9E0 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T1.js new file mode 100644 index 0000000000..847e5e35d6 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits" +es5id: 7.8.3_A2.1_T1 +description: Use .DecimalDigit +---*/ + +//CHECK#0 +if (.0 !== 0.0) { + throw new Test262Error('#0: .0 === 0.0'); +} + +//CHECK#1 +if (.1 !== 0.1) { + throw new Test262Error('#1: .1 === 0.1'); +} + +//CHECK#2 +if (.2 !== 0.2) { + throw new Test262Error('#2: .2 === 0.2'); +} + +//CHECK#3 +if (.3 !== 0.3) { + throw new Test262Error('#3: .3 === 0.3'); +} + +//CHECK#4 +if (.4 !== 0.4) { + throw new Test262Error('#4: .4 === 0.4'); +} + +//CHECK#5 +if (.5 !== 0.5) { + throw new Test262Error('#5: .5 === 0.5'); +} + +//CHECK#6 +if (.6 !== 0.6) { + throw new Test262Error('#6: .6 === 0.6'); +} + +//CHECK#7 +if (.7 !== 0.7) { + throw new Test262Error('#7: .7 === 0.7'); +} + +//CHECK#8 +if (.8 !== 0.8) { + throw new Test262Error('#8: .8 === 0.8'); +} + +//CHECK#9 +if (.9 !== 0.9) { + throw new Test262Error('#9: .9 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T2.js new file mode 100644 index 0000000000..46218eafbc --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits" +es5id: 7.8.3_A2.1_T2 +description: Use .DecimalDigits +---*/ + +//CHECK#0 +if (.00 !== 0.00) { + throw new Test262Error('#0: .00 === 0.00'); +} + +//CHECK#1 +if (.11 !== 0.11) { + throw new Test262Error('#1: .11 === 0.11'); +} + +//CHECK#2 +if (.22 !== 0.22) { + throw new Test262Error('#2: .22 === 0.22'); +} + +//CHECK#3 +if (.33 !== 0.33) { + throw new Test262Error('#3: .33 === 0.33'); +} + +//CHECK#4 +if (.44 !== 0.44) { + throw new Test262Error('#4: .44 === 0.44'); +} + +//CHECK#5 +if (.55 !== 0.55) { + throw new Test262Error('#5: .55 === 0.55'); +} + +//CHECK#6 +if (.66 !== 0.66) { + throw new Test262Error('#6: .66 === 0.66'); +} + +//CHECK#7 +if (.77 !== 0.77) { + throw new Test262Error('#7: .77 === 0.77'); +} + +//CHECK#8 +if (.88 !== 0.88) { + throw new Test262Error('#8: .88 === 0.88'); +} + +//CHECK#9 +if (.99 !== 0.99) { + throw new Test262Error('#9: .99 === 0.99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T3.js new file mode 100644 index 0000000000..ef4cc60330 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.1_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits" +es5id: 7.8.3_A2.1_T3 +description: Use .DecimalDigits that have at the end zeros +---*/ + +//CHECK#0 +if (.00 !== 0.0) { + throw new Test262Error('#0: .0 === 0.0'); +} + +//CHECK#1 +if (.10 !== 0.1) { + throw new Test262Error('#1: .1 === 0.1'); +} + +//CHECK#2 +if (.20 !== 0.2) { + throw new Test262Error('#2: .2 === 0.2'); +} + +//CHECK#3 +if (.30 !== 0.3) { + throw new Test262Error('#3: .3 === 0.3'); +} + +//CHECK#4 +if (.40 !== 0.4) { + throw new Test262Error('#4: .4 === 0.4'); +} + +//CHECK#5 +if (.50 !== 0.5) { + throw new Test262Error('#5: .5 === 0.5'); +} + +//CHECK#6 +if (.60 !== 0.6) { + throw new Test262Error('#6: .6 === 0.6'); +} + +//CHECK#7 +if (.70 !== 0.7) { + throw new Test262Error('#7: .7 === 0.7'); +} + +//CHECK#8 +if (.80 !== 0.8) { + throw new Test262Error('#8: .8 === 0.8'); +} + +//CHECK#9 +if (.90 !== 0.9) { + throw new Test262Error('#9: .9 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T1.js new file mode 100644 index 0000000000..d11565b111 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T1 +description: "ExponentPart :: e DecimalDigits" +---*/ + +//CHECK#0 +if (.0e1 !== 0) { + throw new Test262Error('#0: .0e1 === 0'); +} + +//CHECK#1 +if (.1e1 !== 1) { + throw new Test262Error('#1: .1e1 === 1'); +} + +//CHECK#2 +if (.2e1 !== 2) { + throw new Test262Error('#2: .2e1 === 2'); +} + +//CHECK#3 +if (.3e1 !== 3) { + throw new Test262Error('#3: .3e1 === 3'); +} + +//CHECK#4 +if (.4e1 !== 4) { + throw new Test262Error('#4: .4e1 === 4'); +} + +//CHECK#5 +if (.5e1 !== 5) { + throw new Test262Error('#5: .5e1 === 5'); +} + +//CHECK#6 +if (.6e1 !== 6) { + throw new Test262Error('#6: .6e1 === 6'); +} + +//CHECK#7 +if (.7e1 !== 7) { + throw new Test262Error('#7: .7e1 === 7'); +} + +//CHECK#8 +if (.8e1 !== 8) { + throw new Test262Error('#8: .8e1 === 8'); +} + +//CHECK#9 +if (.9e1 !== 9) { + throw new Test262Error('#9: .9e1 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T2.js new file mode 100644 index 0000000000..6de53e7874 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T2 +description: "ExponentPart :: E DecimalDigits" +---*/ + +//CHECK#0 +if (.0E1 !== 0) { + throw new Test262Error('#0: .0E1 === 0'); +} + +//CHECK#1 +if (.1E1 !== 1) { + throw new Test262Error('#1: .1E1 === 1'); +} + +//CHECK#2 +if (.2E1 !== 2) { + throw new Test262Error('#2: .2E1 === 2'); +} + +//CHECK#3 +if (.3E1 !== 3) { + throw new Test262Error('#3: .3E1 === 3'); +} + +//CHECK#4 +if (.4E1 !== 4) { + throw new Test262Error('#4: .4E1 === 4'); +} + +//CHECK#5 +if (.5E1 !== 5) { + throw new Test262Error('#5: .5E1 === 5'); +} + +//CHECK#6 +if (.6E1 !== 6) { + throw new Test262Error('#6: .6E1 === 6'); +} + +//CHECK#7 +if (.7E1 !== 7) { + throw new Test262Error('#7: .7E1 === 7'); +} + +//CHECK#8 +if (.8E1 !== 8) { + throw new Test262Error('#8: .8E1 === 8'); +} + +//CHECK#9 +if (.9E1 !== 9) { + throw new Test262Error('#9: .9E1 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T3.js new file mode 100644 index 0000000000..7b750b0386 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T3 +description: "ExponentPart :: e +DecimalDigits" +---*/ + +//CHECK#0 +if (.0e-1 !== 0) { + throw new Test262Error('#0: .0e-1 === 0'); +} + +//CHECK#1 +if (.1e-1 !== 0.01) { + throw new Test262Error('#1: .1e-1 === 0.01'); +} + +//CHECK#2 +if (.2e-1 !== 0.02) { + throw new Test262Error('#2: .2e-1 === 0.02'); +} + +//CHECK#3 +if (.3e-1 !== 0.03) { + throw new Test262Error('#3: .3e-1 === 0.03'); +} + +//CHECK#4 +if (.4e-1 !== 0.04) { + throw new Test262Error('#4: .4e-1 === 0.04'); +} + +//CHECK#5 +if (.5e-1 !== 0.05) { + throw new Test262Error('#5: .5e-1 === 0.05'); +} + +//CHECK#6 +if (.6e-1 !== 0.06) { + throw new Test262Error('#6: .6e-1 === 0.06'); +} + +//CHECK#7 +if (.7e-1 !== 0.07) { + throw new Test262Error('#7: .7e-1 === 0.07'); +} + +//CHECK#8 +if (.8e-1 !== 0.08) { + throw new Test262Error('#8: .8e-1 === 0.08'); +} + +//CHECK#9 +if (.9e-1 !== 0.09) { + throw new Test262Error('#9: .9e-1 === 0.09'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T4.js new file mode 100644 index 0000000000..5e986f3ae2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T4 +description: "ExponentPart :: E +DecimalDigits" +---*/ + +//CHECK#0 +if (.0E-1 !== 0) { + throw new Test262Error('#0: .0E-1 === 0'); +} + +//CHECK#1 +if (.1E-1 !== 0.01) { + throw new Test262Error('#1: .1E-1 === 0.01'); +} + +//CHECK#2 +if (.2E-1 !== 0.02) { + throw new Test262Error('#2: .2E-1 === 0.02'); +} + +//CHECK#3 +if (.3E-1 !== 0.03) { + throw new Test262Error('#3: .3E-1 === 0.03'); +} + +//CHECK#4 +if (.4E-1 !== 0.04) { + throw new Test262Error('#4: .4E-1 === 0.04'); +} + +//CHECK#5 +if (.5E-1 !== 0.05) { + throw new Test262Error('#5: .5E-1 === 0.05'); +} + +//CHECK#6 +if (.6E-1 !== 0.06) { + throw new Test262Error('#6: .6E-1 === 0.06'); +} + +//CHECK#7 +if (.7E-1 !== 0.07) { + throw new Test262Error('#7: .7E-1 === 0.07'); +} + +//CHECK#8 +if (.8E-1 !== 0.08) { + throw new Test262Error('#8: .8E-1 === 0.08'); +} + +//CHECK#9 +if (.9E-1 !== 0.09) { + throw new Test262Error('#9: .9E-1 === 0.09'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T5.js new file mode 100644 index 0000000000..54ef29a8d5 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T5 +description: "ExponentPart :: e +DecimalDigits" +---*/ + +//CHECK#0 +if (.0e+1 !== 0) { + throw new Test262Error('#0: .0e+1 === 0'); +} + +//CHECK#1 +if (.1e+1 !== 1) { + throw new Test262Error('#1: .1e+1 === 1'); +} + +//CHECK#2 +if (.2e+1 !== 2) { + throw new Test262Error('#2: .2e+1 === 2'); +} + +//CHECK#3 +if (.3e+1 !== 3) { + throw new Test262Error('#3: .3e+1 === 3'); +} + +//CHECK#4 +if (.4e+1 !== 4) { + throw new Test262Error('#4: .4e+1 === 4'); +} + +//CHECK#5 +if (.5e+1 !== 5) { + throw new Test262Error('#5: .5e+1 === 5'); +} + +//CHECK#6 +if (.6e+1 !== 6) { + throw new Test262Error('#6: .6e+1 === 6'); +} + +//CHECK#7 +if (.7e+1 !== 7) { + throw new Test262Error('#7: .7e+1 === 7'); +} + +//CHECK#8 +if (.8e+1 !== 8) { + throw new Test262Error('#8: .8e+1 === 8'); +} + +//CHECK#9 +if (.9e+1 !== 9) { + throw new Test262Error('#9: .9e+1 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T6.js new file mode 100644 index 0000000000..d922634c1d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T6.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T6 +description: "ExponentPart :: E +DecimalDigits" +---*/ + +//CHECK#0 +if (.0E+1 !== 0) { + throw new Test262Error('#0: .0E+1 === 0'); +} + +//CHECK#1 +if (.1E+1 !== 1) { + throw new Test262Error('#1: .1E+1 === 1'); +} + +//CHECK#2 +if (.2E+1 !== 2) { + throw new Test262Error('#2: .2E+1 === 2'); +} + +//CHECK#3 +if (.3E+1 !== 3) { + throw new Test262Error('#3: .3E+1 === 3'); +} + +//CHECK#4 +if (.4E+1 !== 4) { + throw new Test262Error('#4: .4E+1 === 4'); +} + +//CHECK#5 +if (.5E+1 !== 5) { + throw new Test262Error('#5: .5E+1 === 5'); +} + +//CHECK#6 +if (.6E+1 !== 6) { + throw new Test262Error('#6: .6E+1 === 6'); +} + +//CHECK#7 +if (.7E+1 !== 7) { + throw new Test262Error('#7: .7E+1 === 7'); +} + +//CHECK#8 +if (.8E+1 !== 8) { + throw new Test262Error('#8: .8E+1 === 8'); +} + +//CHECK#9 +if (.9E+1 !== 9) { + throw new Test262Error('#9: .9E+1 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T7.js new file mode 100644 index 0000000000..9cb8eb7036 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T7 +description: "ExponentPart :: e 0" +---*/ + +//CHECK#0 +if (.0e0 !== 0.0) { + throw new Test262Error('#0: .0e0 === 0.0'); +} + +//CHECK#1 +if (.1e0 !== 0.1) { + throw new Test262Error('#1: .1e0 === 0.1'); +} + +//CHECK#2 +if (.2e0 !== 0.2) { + throw new Test262Error('#2: .2e0 === 0.2'); +} + +//CHECK#3 +if (.3e0 !== 0.3) { + throw new Test262Error('#3: .3e0 === 0.3'); +} + +//CHECK#4 +if (.4e0 !== 0.4) { + throw new Test262Error('#4: .4e0 === 0.4'); +} + +//CHECK#5 +if (.5e0 !== 0.5) { + throw new Test262Error('#5: .5e0 === 0.5'); +} + +//CHECK#6 +if (.6e0 !== 0.6) { + throw new Test262Error('#6: .6e0 === 0.6'); +} + +//CHECK#7 +if (.7e0 !== 0.7) { + throw new Test262Error('#7: .7e0 === 0.7'); +} + +//CHECK#8 +if (.8e0 !== 0.8) { + throw new Test262Error('#8: .8e0 === 0.8'); +} + +//CHECK#9 +if (.9e0 !== 0.9) { + throw new Test262Error('#9: .9e0 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T8.js new file mode 100644 index 0000000000..eca19e538d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A2.2_T8.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: .DecimalDigits ExponentPart" +es5id: 7.8.3_A2.2_T8 +description: "ExponentPart :: E 0" +---*/ + +//CHECK#0 +if (.0E0 !== 0.0) { + throw new Test262Error('#0: .0E0 === 0.0'); +} + +//CHECK#1 +if (.1E0 !== 0.1) { + throw new Test262Error('#1: .1E0 === 0.1'); +} + +//CHECK#2 +if (.2E0 !== 0.2) { + throw new Test262Error('#2: .2E0 === 0.2'); +} + +//CHECK#3 +if (.3E0 !== 0.3) { + throw new Test262Error('#3: .3E0 === 0.3'); +} + +//CHECK#4 +if (.4E0 !== 0.4) { + throw new Test262Error('#4: .4E0 === 0.4'); +} + +//CHECK#5 +if (.5E0 !== 0.5) { + throw new Test262Error('#5: .5E0 === 0.5'); +} + +//CHECK#6 +if (.6E0 !== 0.6) { + throw new Test262Error('#6: .6E0 === 0.6'); +} + +//CHECK#7 +if (.7E0 !== 0.7) { + throw new Test262Error('#7: .7E0 === 0.7'); +} + +//CHECK#8 +if (.8E0 !== 0.8) { + throw new Test262Error('#8: .8E0 === 0.8'); +} + +//CHECK#9 +if (.9E0 !== 0.9) { + throw new Test262Error('#9: .9E0 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T1.js new file mode 100644 index 0000000000..b91bff9334 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral." +es5id: 7.8.3_A3.1_T1 +description: "DecimalIntegerLiteral :: 0, NoNZeroDigit" +---*/ + +//CHECK#0 +if (0. !== 0) { + throw new Test262Error('#0: 0. === 0'); +} + +//CHECK#1 +if (1. !== 1) { + throw new Test262Error('#1: 1. === 1'); +} + +//CHECK#2 +if (2. !== 2) { + throw new Test262Error('#2: 2. === 2'); +} + +//CHECK#3 +if (3. !== 3) { + throw new Test262Error('#3: 3. === 3'); +} + +//CHECK#4 +if (4. !== 4) { + throw new Test262Error('#4: 4. === 4'); +} + +//CHECK#5 +if (5. !== 5) { + throw new Test262Error('#5: 5. === 5'); +} + +//CHECK#6 +if (6. !== 6) { + throw new Test262Error('#6: 6. === 6'); +} + +//CHECK#7 +if (7. !== 7) { + throw new Test262Error('#7: 7. === 7'); +} + +//CHECK#8 +if (8. !== 8) { + throw new Test262Error('#8: 8. === 8'); +} + +//CHECK#9 +if (9. !== 9) { + throw new Test262Error('#9: 9. === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T2.js new file mode 100644 index 0000000000..d9a968a685 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral." +es5id: 7.8.3_A3.1_T2 +description: "DecimalIntegerLiteral :: NoNZeroDigit DecimalDigigts" +---*/ + +//CHECK#1 +if (11. !== 11) { + throw new Test262Error('#1: 11. === 11'); +} + +//CHECK#2 +if (22. !== 22) { + throw new Test262Error('#2: 22. === 22'); +} + +//CHECK#3 +if (33. !== 33) { + throw new Test262Error('#3: 33. === 33'); +} + +//CHECK#4 +if (44. !== 44) { + throw new Test262Error('#4: 44. === 44'); +} + +//CHECK#5 +if (55. !== 55) { + throw new Test262Error('#5: 55. === 55'); +} + +//CHECK#6 +if (66. !== 66) { + throw new Test262Error('#6: 66. === 66'); +} + +//CHECK#7 +if (77. !== 77) { + throw new Test262Error('#7: 77. === 77'); +} + +//CHECK#8 +if (88. !== 88) { + throw new Test262Error('#8: 88. === 88'); +} + +//CHECK#9 +if (99. !== 99) { + throw new Test262Error('#9: 99. === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T1.js new file mode 100644 index 0000000000..bd5f7582b9 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigits" +es5id: 7.8.3_A3.2_T1 +description: After DecimalIntegerLiteral. used ZeroDigit +---*/ + +//CHECK#0 +if (0.0 !== 0) { + throw new Test262Error('#0: 0.0 === 0'); +} + +//CHECK#1 +if (1.0 !== 1) { + throw new Test262Error('#1: 1.0 === 1'); +} + +//CHECK#2 +if (2.0 !== 2) { + throw new Test262Error('#2: 2.0 === 2'); +} + +//CHECK#3 +if (3.0 !== 3) { + throw new Test262Error('#3: 3.0 === 3'); +} + +//CHECK#4 +if (4.0 !== 4) { + throw new Test262Error('#4: 4.0 === 4'); +} + +//CHECK#5 +if (5.0 !== 5) { + throw new Test262Error('#5: 5.0 === 5'); +} + +//CHECK#6 +if (6.0 !== 6) { + throw new Test262Error('#6: 6.0 === 6'); +} + +//CHECK#7 +if (7.0 !== 7) { + throw new Test262Error('#7: 7.0 === 7'); +} + +//CHECK#8 +if (8.0 !== 8) { + throw new Test262Error('#8: 8.0 === 8'); +} + +//CHECK#9 +if (9.0 !== 9) { + throw new Test262Error('#9: 9.0 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T2.js new file mode 100644 index 0000000000..6243c7441a --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigits" +es5id: 7.8.3_A3.2_T2 +description: After DecimalIntegerLiteral. used ZeroDigits +---*/ + +//CHECK#0 +if (0.00 !== 0) { + throw new Test262Error('#0: 0.00 === 0'); +} + +//CHECK#1 +if (1.00 !== 1) { + throw new Test262Error('#1: 1.00 === 1'); +} + +//CHECK#2 +if (2.00 !== 2) { + throw new Test262Error('#2: 2.00 === 2'); +} + +//CHECK#3 +if (3.00 !== 3) { + throw new Test262Error('#3: 3.00 === 3'); +} + +//CHECK#4 +if (4.00 !== 4) { + throw new Test262Error('#4: 4.00 === 4'); +} + +//CHECK#5 +if (5.00 !== 5) { + throw new Test262Error('#5: 5.00 === 5'); +} + +//CHECK#6 +if (6.00 !== 6) { + throw new Test262Error('#6: 6.00 === 6'); +} + +//CHECK#7 +if (7.00 !== 7) { + throw new Test262Error('#7: 7.00 === 7'); +} + +//CHECK#8 +if (8.00 !== 8) { + throw new Test262Error('#8: 8.00 === 8'); +} + +//CHECK#9 +if (9.00 !== 9) { + throw new Test262Error('#9: 9.00 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T3.js new file mode 100644 index 0000000000..71d65dffba --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.2_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigits" +es5id: 7.8.3_A3.2_T3 +description: After DecimalIntegerLiteral. used NoNZeroDigit +---*/ + +//CHECK#0 +if (0.0 !== 0.0) { + throw new Test262Error('#0: 0.0 === 0.0'); +} + +//CHECK#1 +if (1.1 !== 1.1) { + throw new Test262Error('#1: 1.1 === 1.1'); +} + +//CHECK#2 +if (2.2 !== 2.2) { + throw new Test262Error('#2: 2.2 === 2.2'); +} + +//CHECK#3 +if (3.3 !== 3.3) { + throw new Test262Error('#3: 3.3 === 3.3'); +} + +//CHECK#4 +if (4.4 !== 4.4) { + throw new Test262Error('#4: 4.4 === 4.4'); +} + +//CHECK#5 +if (5.5 !== 5.5) { + throw new Test262Error('#5: 5.5 === 5.5'); +} + +//CHECK#6 +if (6.6 !== 6.6) { + throw new Test262Error('#6: 6.6 === 6.6'); +} + +//CHECK#7 +if (7.7 !== 7.7) { + throw new Test262Error('#7: 7.7 === 7.7'); +} + +//CHECK#8 +if (8.8 !== 8.8) { + throw new Test262Error('#8: 8..8 === 8.8'); +} + +//CHECK#9 +if (9.9 !== 9.9) { + throw new Test262Error('#9: 9.9 === 9.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T1.js new file mode 100644 index 0000000000..e083ac5563 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T1 +description: "ExponentPart :: e DecimalDigits" +---*/ + +//CHECK#0 +if (0.e1 !== 0) { + throw new Test262Error('#0: 0.e1 === 0'); +} + +//CHECK#1 +if (1.e1 !== 10) { + throw new Test262Error('#1: 1.e1 === 10'); +} + +//CHECK#2 +if (2.e1 !== 20) { + throw new Test262Error('#2: 2.e1 === 20'); +} + +//CHECK#3 +if (3.e1 !== 30) { + throw new Test262Error('#3: 3.e1 === 30'); +} + +//CHECK#4 +if (4.e1 !== 40) { + throw new Test262Error('#4: 4.e1 === 40'); +} + +//CHECK#5 +if (5.e1 !== 50) { + throw new Test262Error('#5: 5.e1 === 50'); +} + +//CHECK#6 +if (6.e1 !== 60) { + throw new Test262Error('#6: 6.e1 === 60'); +} + +//CHECK#7 +if (7.e1 !== 70) { + throw new Test262Error('#7: 7.e1 === 70'); +} + +//CHECK#8 +if (8.e1 !== 80) { + throw new Test262Error('#8: 8.e1 === 80'); +} + +//CHECK#9 +if (9.e1 !== 90) { + throw new Test262Error('#9: 9.e1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T2.js new file mode 100644 index 0000000000..10ee466d8b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T2 +description: "ExponentPart :: E DecimalDigits" +---*/ + +//CHECK#0 +if (0.E1 !== 0) { + throw new Test262Error('#0: 0.E1 === 0'); +} + +//CHECK#1 +if (1.E1 !== 10) { + throw new Test262Error('#1: 1.E1 === 10'); +} + +//CHECK#2 +if (2.E1 !== 20) { + throw new Test262Error('#2: 2.E1 === 20'); +} + +//CHECK#3 +if (3.E1 !== 30) { + throw new Test262Error('#3: 3.E1 === 30'); +} + +//CHECK#4 +if (4.E1 !== 40) { + throw new Test262Error('#4: 4.E1 === 40'); +} + +//CHECK#5 +if (5.E1 !== 50) { + throw new Test262Error('#5: 5.E1 === 50'); +} + +//CHECK#6 +if (6.E1 !== 60) { + throw new Test262Error('#6: 6.E1 === 60'); +} + +//CHECK#7 +if (7.E1 !== 70) { + throw new Test262Error('#7: 7.E1 === 70'); +} + +//CHECK#8 +if (8.E1 !== 80) { + throw new Test262Error('#8: 8.E1 === 80'); +} + +//CHECK#9 +if (9.E1 !== 90) { + throw new Test262Error('#9: 9.E1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T3.js new file mode 100644 index 0000000000..ec6e50e55e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T3 +description: "ExponentPart :: e -DecimalDigits" +---*/ + +//CHECK#0 +if (0.e-1 !== 0) { + throw new Test262Error('#0: 0.e-1 === 0'); +} + +//CHECK#1 +if (1.e-1 !== 0.1) { + throw new Test262Error('#1: 1.e-1 === 0.1'); +} + +//CHECK#2 +if (2.e-1 !== 0.2) { + throw new Test262Error('#2: 2.e-1 === 0.2'); +} + +//CHECK#3 +if (3.e-1 !== 0.3) { + throw new Test262Error('#3: 3.e-1 === 0.3'); +} + +//CHECK#4 +if (4.e-1 !== 0.4) { + throw new Test262Error('#4: 4.e-1 === 0.4'); +} + +//CHECK#5 +if (5.e-1 !== 0.5) { + throw new Test262Error('#5: 5.e-1 === 0.5'); +} + +//CHECK#6 +if (6.e-1 !== 0.6) { + throw new Test262Error('#6: 6.e-1 === 0.6'); +} + +//CHECK#7 +if (7.e-1 !== 0.7) { + throw new Test262Error('#7: 7.e-1 === 0.7'); +} + +//CHECK#8 +if (8.e-1 !== 0.8) { + throw new Test262Error('#8: 8.e-1 === 0.8'); +} + +//CHECK#9 +if (9.e-1 !== 0.9) { + throw new Test262Error('#9: 9.e-1 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T4.js new file mode 100644 index 0000000000..4a70140810 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T4 +description: "ExponentPart :: E -DecimalDigits" +---*/ + +//CHECK#0 +if (0.E-1 !== 0) { + throw new Test262Error('#0: 0.E-1 === 0'); +} + +//CHECK#1 +if (1.E-1 !== 0.1) { + throw new Test262Error('#1: 1.E-1 === 0.1'); +} + +//CHECK#2 +if (2.E-1 !== 0.2) { + throw new Test262Error('#2: 2.E-1 === 0.2'); +} + +//CHECK#3 +if (3.E-1 !== 0.3) { + throw new Test262Error('#3: 3.E-1 === 0.3'); +} + +//CHECK#4 +if (4.E-1 !== 0.4) { + throw new Test262Error('#4: 4.E-1 === 0.4'); +} + +//CHECK#5 +if (5.E-1 !== 0.5) { + throw new Test262Error('#5: 5.E-1 === 0.5'); +} + +//CHECK#6 +if (6.E-1 !== 0.6) { + throw new Test262Error('#6: 6.E-1 === 0.6'); +} + +//CHECK#7 +if (7.E-1 !== 0.7) { + throw new Test262Error('#7: 7.E-1 === 0.7'); +} + +//CHECK#8 +if (8.E-1 !== 0.8) { + throw new Test262Error('#8: 8.E-1 === 0.8'); +} + +//CHECK#9 +if (9.E-1 !== 0.9) { + throw new Test262Error('#9: 9.E-1 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T5.js new file mode 100644 index 0000000000..624c152890 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T5 +description: "ExponentPart :: e +DecimalDigits" +---*/ + +//CHECK#0 +if (0.e+1 !== 0) { + throw new Test262Error('#0: 0.e+1 === 0'); +} + +//CHECK#1 +if (1.e+1 !== 10) { + throw new Test262Error('#1: 1.e+1 === 10'); +} + +//CHECK#2 +if (2.e+1 !== 20) { + throw new Test262Error('#2: 2.e+1 === 20'); +} + +//CHECK#3 +if (3.e+1 !== 30) { + throw new Test262Error('#3: 3.e+1 === 30'); +} + +//CHECK#4 +if (4.e+1 !== 40) { + throw new Test262Error('#4: 4.e+1 === 40'); +} + +//CHECK#5 +if (5.e+1 !== 50) { + throw new Test262Error('#5: 5.e+1 === 50'); +} + +//CHECK#6 +if (6.e+1 !== 60) { + throw new Test262Error('#6: 6.e+1 === 60'); +} + +//CHECK#7 +if (7.e+1 !== 70) { + throw new Test262Error('#7: 7.e+1 === 70'); +} + +//CHECK#8 +if (8.e+1 !== 80) { + throw new Test262Error('#8: 8.e+1 === 80'); +} + +//CHECK#9 +if (9.e+1 !== 90) { + throw new Test262Error('#9: 9.e+1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T6.js new file mode 100644 index 0000000000..d016066531 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T6.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T6 +description: "ExponentPart :: E +DecimalDigits" +---*/ + +//CHECK#0 +if (0.E+1 !== 0) { + throw new Test262Error('#0: 0.E+1 === 0'); +} + +//CHECK#1 +if (1.E+1 !== 10) { + throw new Test262Error('#1: 1.E+1 === 10'); +} + +//CHECK#2 +if (2.E+1 !== 20) { + throw new Test262Error('#2: 2.E+1 === 20'); +} + +//CHECK#3 +if (3.E+1 !== 30) { + throw new Test262Error('#3: 3.E+1 === 30'); +} + +//CHECK#4 +if (4.E+1 !== 40) { + throw new Test262Error('#4: 4.E+1 === 40'); +} + +//CHECK#5 +if (5.E+1 !== 50) { + throw new Test262Error('#5: 5.E+1 === 50'); +} + +//CHECK#6 +if (6.E+1 !== 60) { + throw new Test262Error('#6: 6.E+1 === 60'); +} + +//CHECK#7 +if (7.E+1 !== 70) { + throw new Test262Error('#7: 7.E+1 === 70'); +} + +//CHECK#8 +if (8.E+1 !== 80) { + throw new Test262Error('#8: 8.E+1 === 80'); +} + +//CHECK#9 +if (9.E+1 !== 90) { + throw new Test262Error('#9: 9.E+1 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T7.js new file mode 100644 index 0000000000..fec881e1d7 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T7 +description: "ExponentPart :: e 0" +---*/ + +//CHECK#0 +if (0.e0 !== 0) { + throw new Test262Error('#0: 0.e0 === 0'); +} + +//CHECK#1 +if (1.e0 !== 1) { + throw new Test262Error('#1: 1.e0 === 1'); +} + +//CHECK#2 +if (2.e0 !== 2) { + throw new Test262Error('#2: 2.e0 === 2'); +} + +//CHECK#3 +if (3.e0 !== 3) { + throw new Test262Error('#3: 3.e0 === 3'); +} + +//CHECK#4 +if (4.e0 !== 4) { + throw new Test262Error('#4: 4.e0 === 4'); +} + +//CHECK#5 +if (5.e0 !== 5) { + throw new Test262Error('#5: 5.e0 === 5'); +} + +//CHECK#6 +if (6.e0 !== 6) { + throw new Test262Error('#6: 6.e0 === 6'); +} + +//CHECK#7 +if (7.e0 !== 7) { + throw new Test262Error('#7: 7.e0 === 7'); +} + +//CHECK#8 +if (8.e0 !== 8) { + throw new Test262Error('#8: 8.e0 === 8'); +} + +//CHECK#9 +if (9.e0 !== 9) { + throw new Test262Error('#9: 9.e0 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T8.js new file mode 100644 index 0000000000..8d69621ecb --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.3_T8.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. ExponentPart" +es5id: 7.8.3_A3.3_T8 +description: "ExponentPart :: E 0" +---*/ + +//CHECK#0 +if (0.E0 !== 0) { + throw new Test262Error('#0: 0.E0 === 0'); +} + +//CHECK#1 +if (1.E0 !== 1) { + throw new Test262Error('#1: 1.E0 === 1'); +} + +//CHECK#2 +if (2.E0 !== 2) { + throw new Test262Error('#2: 2.E0 === 2'); +} + +//CHECK#3 +if (3.E0 !== 3) { + throw new Test262Error('#3: 3.E0 === 3'); +} + +//CHECK#4 +if (4.E0 !== 4) { + throw new Test262Error('#4: 4.E0 === 4'); +} + +//CHECK#5 +if (5.E0 !== 5) { + throw new Test262Error('#5: 5.E0 === 5'); +} + +//CHECK#6 +if (6.E0 !== 6) { + throw new Test262Error('#6: 6.E0 === 6'); +} + +//CHECK#7 +if (7.E0 !== 7) { + throw new Test262Error('#7: 7.E0 === 7'); +} + +//CHECK#8 +if (8.E0 !== 8) { + throw new Test262Error('#8: 8.E0 === 8'); +} + +//CHECK#9 +if (9.E0 !== 9) { + throw new Test262Error('#9: 9.E0 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T1.js new file mode 100644 index 0000000000..865feec61c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T1 +description: "ExponentPart :: e DecimalDigits" +---*/ + +//CHECK#0 +if (0.0e1 !== 0) { + throw new Test262Error('#0: 0.0e1 === 0'); +} + +//CHECK#1 +if (1.1e1 !== 11) { + throw new Test262Error('#1: 1.1e1 === 11'); +} + +//CHECK#2 +if (2.2e1 !== 22) { + throw new Test262Error('#2: 2.2e1 === 22'); +} + +//CHECK#3 +if (3.3e1 !== 33) { + throw new Test262Error('#3: 3.3e1 === 33'); +} + +//CHECK#4 +if (4.4e1 !== 44) { + throw new Test262Error('#4: 4.4e1 === 44'); +} + +//CHECK#5 +if (5.5e1 !== 55) { + throw new Test262Error('#5: 5.5e1 === 55'); +} + +//CHECK#6 +if (6.6e1 !== 66) { + throw new Test262Error('#6: 6.e1 === 66'); +} + +//CHECK#7 +if (7.7e1 !== 77) { + throw new Test262Error('#7: 7.7e1 === 77'); +} + +//CHECK#8 +if (8.8e1 !== 88) { + throw new Test262Error('#8: 8.8e1 === 88'); +} + +//CHECK#9 +if (9.9e1 !== 99) { + throw new Test262Error('#9: 9.9e1 === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T2.js new file mode 100644 index 0000000000..4d3b49af6b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T2 +description: "ExponentPart :: E DecimalDigits" +---*/ + +//CHECK#0 +if (0.0E1 !== 0) { + throw new Test262Error('#0: 0.0E1 === 0'); +} + +//CHECK#1 +if (1.1E1 !== 11) { + throw new Test262Error('#1: 1.1E1 === 11'); +} + +//CHECK#2 +if (2.2E1 !== 22) { + throw new Test262Error('#2: 2.2E1 === 22'); +} + +//CHECK#3 +if (3.3E1 !== 33) { + throw new Test262Error('#3: 3.3E1 === 33'); +} + +//CHECK#4 +if (4.4E1 !== 44) { + throw new Test262Error('#4: 4.4E1 === 44'); +} + +//CHECK#5 +if (5.5E1 !== 55) { + throw new Test262Error('#5: 5.5E1 === 55'); +} + +//CHECK#6 +if (6.6E1 !== 66) { + throw new Test262Error('#6: 6.E1 === 66'); +} + +//CHECK#7 +if (7.7E1 !== 77) { + throw new Test262Error('#7: 7.7E1 === 77'); +} + +//CHECK#8 +if (8.8E1 !== 88) { + throw new Test262Error('#8: 8.8E1 === 88'); +} + +//CHECK#9 +if (9.9E1 !== 99) { + throw new Test262Error('#9: 9.9E1 === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T3.js new file mode 100644 index 0000000000..88f488ba7c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T3 +description: "ExponentPart :: e -DecimalDigits" +---*/ + +//CHECK#0 +if (0.0e-1 !== 0) { + throw new Test262Error('#0: 0.0e-1 === 0'); +} + +//CHECK#1 +if (1.1e-1 !== 0.11) { + throw new Test262Error('#1: 1.1e-1 === 0.11'); +} + +//CHECK#2 +if (2.2e-1 !== 0.22) { + throw new Test262Error('#2: 2.2e-1 === 0.22'); +} + +//CHECK#3 +if (3.3e-1 !== 0.33) { + throw new Test262Error('#3: 3.3e-1 === 0.33'); +} + +//CHECK#4 +if (4.4e-1 !== 0.44) { + throw new Test262Error('#4: 4.4e-1 === 0.44'); +} + +//CHECK#5 +if (5.5e-1 !== 0.55) { + throw new Test262Error('#5: 5.5e-1 === 0.55'); +} + +//CHECK#6 +if (6.6e-1 !== 0.66) { + throw new Test262Error('#6: 6.e-1 === 0.66'); +} + +//CHECK#7 +if (7.7e-1 !== 0.77) { + throw new Test262Error('#7: 7.7e-1 === 0.77'); +} + +//CHECK#8 +if (8.8e-1 !== 0.88) { + throw new Test262Error('#8: 8.8e-1 === 0.88'); +} + +//CHECK#9 +if (9.9e-1 !== 0.99) { + throw new Test262Error('#9: 9.9e-1 === 0.99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T4.js new file mode 100644 index 0000000000..f4b5d75c10 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T4 +description: "ExponentPart :: E -DecimalDigits" +---*/ + +//CHECK#0 +if (0.0E-1 !== 0) { + throw new Test262Error('#0: 0.0E-1 === 0'); +} + +//CHECK#1 +if (1.1E-1 !== 0.11) { + throw new Test262Error('#1: 1.1E-1 === 0.11'); +} + +//CHECK#2 +if (2.2E-1 !== 0.22) { + throw new Test262Error('#2: 2.2E-1 === 0.22'); +} + +//CHECK#3 +if (3.3E-1 !== 0.33) { + throw new Test262Error('#3: 3.3E-1 === 0.33'); +} + +//CHECK#4 +if (4.4E-1 !== 0.44) { + throw new Test262Error('#4: 4.4E-1 === 0.44'); +} + +//CHECK#5 +if (5.5E-1 !== 0.55) { + throw new Test262Error('#5: 5.5E-1 === 0.55'); +} + +//CHECK#6 +if (6.6E-1 !== 0.66) { + throw new Test262Error('#6: 6.E-1 === 0.66'); +} + +//CHECK#7 +if (7.7E-1 !== 0.77) { + throw new Test262Error('#7: 7.7E-1 === 0.77'); +} + +//CHECK#8 +if (8.8E-1 !== 0.88) { + throw new Test262Error('#8: 8.8E-1 === 0.88'); +} + +//CHECK#9 +if (9.9E-1 !== 0.99) { + throw new Test262Error('#9: 9.9E-1 === 0.99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T5.js new file mode 100644 index 0000000000..f25d3fb008 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T5 +description: "ExponentPart :: e +DecimalDigits" +---*/ + +//CHECK#0 +if (0.0e+1 !== 0) { + throw new Test262Error('#0: 0.0e+1 === 0'); +} + +//CHECK#1 +if (1.1e+1 !== 11) { + throw new Test262Error('#1: 1.1e+1 === 11'); +} + +//CHECK#2 +if (2.2e+1 !== 22) { + throw new Test262Error('#2: 2.2e+1 === 22'); +} + +//CHECK#3 +if (3.3e+1 !== 33) { + throw new Test262Error('#3: 3.3e+1 === 33'); +} + +//CHECK#4 +if (4.4e+1 !== 44) { + throw new Test262Error('#4: 4.4e+1 === 44'); +} + +//CHECK#5 +if (5.5e+1 !== 55) { + throw new Test262Error('#5: 5.5e+1 === 55'); +} + +//CHECK#6 +if (6.6e+1 !== 66) { + throw new Test262Error('#6: 6.e+1 === 66'); +} + +//CHECK#7 +if (7.7e+1 !== 77) { + throw new Test262Error('#7: 7.7e+1 === 77'); +} + +//CHECK#8 +if (8.8e+1 !== 88) { + throw new Test262Error('#8: 8.8e+1 === 88'); +} + +//CHECK#9 +if (9.9e+1 !== 99) { + throw new Test262Error('#9: 9.9e+1 === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T6.js new file mode 100644 index 0000000000..e2f77e702c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T6.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T6 +description: "ExponentPart :: E +DecimalDigits" +---*/ + +//CHECK#0 +if (0.0E+1 !== 0) { + throw new Test262Error('#0: 0.0E+1 === 0'); +} + +//CHECK#1 +if (1.1E+1 !== 11) { + throw new Test262Error('#1: 1.1E+1 === 11'); +} + +//CHECK#2 +if (2.2E+1 !== 22) { + throw new Test262Error('#2: 2.2E+1 === 22'); +} + +//CHECK#3 +if (3.3E+1 !== 33) { + throw new Test262Error('#3: 3.3E+1 === 33'); +} + +//CHECK#4 +if (4.4E+1 !== 44) { + throw new Test262Error('#4: 4.4E+1 === 44'); +} + +//CHECK#5 +if (5.5E+1 !== 55) { + throw new Test262Error('#5: 5.5E+1 === 55'); +} + +//CHECK#6 +if (6.6E+1 !== 66) { + throw new Test262Error('#6: 6.E+1 === 66'); +} + +//CHECK#7 +if (7.7E+1 !== 77) { + throw new Test262Error('#7: 7.7E+1 === 77'); +} + +//CHECK#8 +if (8.8E+1 !== 88) { + throw new Test262Error('#8: 8.8E+1 === 88'); +} + +//CHECK#9 +if (9.9E+1 !== 99) { + throw new Test262Error('#9: 9.9E+1 === 99'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T7.js new file mode 100644 index 0000000000..8f474c8781 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T7 +description: "ExponentPart :: e 0" +---*/ + +//CHECK#0 +if (0.0e0 !== 0.0) { + throw new Test262Error('#0: 0.0e0 === 0.0'); +} + +//CHECK#1 +if (1.1e0 !== 1.1) { + throw new Test262Error('#1: 1.1e0 === 1.1'); +} + +//CHECK#2 +if (2.2e0 !== 2.2) { + throw new Test262Error('#2: 2.2e0 === 2.2'); +} + +//CHECK#3 +if (3.3e0 !== 3.3) { + throw new Test262Error('#3: 3.3e0 === 3.3'); +} + +//CHECK#4 +if (4.4e0 !== 4.4) { + throw new Test262Error('#4: 4.4e0 === 4.4'); +} + +//CHECK#5 +if (5.5e0 !== 5.5) { + throw new Test262Error('#5: 5.5e0 === 5.5'); +} + +//CHECK#6 +if (6.6e0 !== 6.6) { + throw new Test262Error('#6: 6.e0 === 6.6'); +} + +//CHECK#7 +if (7.7e0 !== 7.7) { + throw new Test262Error('#7: 7.7e0 === 7.7'); +} + +//CHECK#8 +if (8.8e0 !== 8.8) { + throw new Test262Error('#8: 8.8e0 === 8.8'); +} + +//CHECK#9 +if (9.9e0 !== 9.9) { + throw new Test262Error('#9: 9.9e0 === 9.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T8.js new file mode 100644 index 0000000000..fbb5b57d8f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A3.4_T8.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: DecimalIntegerLiteral. DecimalDigigts ExponentPart" +es5id: 7.8.3_A3.4_T8 +description: "ExponentPart :: E 0" +---*/ + +//CHECK#0 +if (0.0E0 !== 0.0) { + throw new Test262Error('#0: 0.0E0 === 0.0'); +} + +//CHECK#1 +if (1.1E0 !== 1.1) { + throw new Test262Error('#1: 1.1E0 === 1.1'); +} + +//CHECK#2 +if (2.2E0 !== 2.2) { + throw new Test262Error('#2: 2.2E0 === 2.2'); +} + +//CHECK#3 +if (3.3E0 !== 3.3) { + throw new Test262Error('#3: 3.3E0 === 3.3'); +} + +//CHECK#4 +if (4.4E0 !== 4.4) { + throw new Test262Error('#4: 4.4E0 === 4.4'); +} + +//CHECK#5 +if (5.5E0 !== 5.5) { + throw new Test262Error('#5: 5.5E0 === 5.5'); +} + +//CHECK#6 +if (6.6E0 !== 6.6) { + throw new Test262Error('#6: 6.E0 === 6.6'); +} + +//CHECK#7 +if (7.7E0 !== 7.7) { + throw new Test262Error('#7: 7.7E0 === 7.7'); +} + +//CHECK#8 +if (8.8E0 !== 8.8) { + throw new Test262Error('#8: 8.8E0 === 8.8'); +} + +//CHECK#9 +if (9.9E0 !== 9.9) { + throw new Test262Error('#9: 9.9E0 === 9.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T1.js new file mode 100644 index 0000000000..3c13bcbe3f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T1 +description: "ExponentPart :: e DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + e1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T2.js new file mode 100644 index 0000000000..2b40f8f200 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T2 +description: "ExponentPart :: E DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + E1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T3.js new file mode 100644 index 0000000000..b9a8fa8867 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T3.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T3 +description: "ExponentPart :: e DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + e-1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T4.js new file mode 100644 index 0000000000..1b733e632d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T4.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T4 +description: "ExponentPart :: E DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + E-1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T5.js new file mode 100644 index 0000000000..a68ab1bdc2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T5.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T5 +description: "ExponentPart :: e DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + e+1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T6.js new file mode 100644 index 0000000000..5fdcdee4d5 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T6.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T6 +description: "ExponentPart :: E DecimalDigits" +---*/ + +assert.throws(ReferenceError, function() { + E+1 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T7.js new file mode 100644 index 0000000000..3c1ba69f05 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T7.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T7 +description: "ExponentPart :: e 0" +---*/ + +assert.throws(ReferenceError, function() { + e0 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T8.js new file mode 100644 index 0000000000..27ee68030c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.1_T8.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: ExponentPart is incorrect" +es5id: 7.8.3_A4.1_T8 +description: "ExponentPart :: E 0" +---*/ + +assert.throws(ReferenceError, function() { + E0 +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T1.js new file mode 100644 index 0000000000..70d8e5988b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T1 +description: "ExponentIndicator :: e" +---*/ + +//CHECK#0 +if (0e01 !== 0) { + throw new Test262Error('#0: 0e01 === 0'); +} + +//CHECK#1 +if (1e01 !== 10) { + throw new Test262Error('#1: 1e01 === 10'); +} + +//CHECK#2 +if (2e01 !== 20) { + throw new Test262Error('#2: 2e01 === 20'); +} + +//CHECK#3 +if (3e01 !== 30) { + throw new Test262Error('#3: 3e01 === 30'); +} + +//CHECK#4 +if (4e01 !== 40) { + throw new Test262Error('#4: 4e01 === 40'); +} + +//CHECK#5 +if (5e01 !== 50) { + throw new Test262Error('#5: 5e01 === 50'); +} + +//CHECK#6 +if (6e01 !== 60) { + throw new Test262Error('#6: 6e01 === 60'); +} + +//CHECK#7 +if (7e01 !== 70) { + throw new Test262Error('#7: 7e01 === 70'); +} + +//CHECK#8 +if (8e01 !== 80) { + throw new Test262Error('#8: 8e01 === 80'); +} + +//CHECK#9 +if (9e01 !== 90) { + throw new Test262Error('#9: 9e01 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T2.js new file mode 100644 index 0000000000..49c54a842f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T2 +description: "ExponentIndicator :: E" +---*/ + +//CHECK#0 +if (0E01 !== 0) { + throw new Test262Error('#0: 0E01 === 0'); +} + +//CHECK#1 +if (1E01 !== 10) { + throw new Test262Error('#1: 1E01 === 10'); +} + +//CHECK#2 +if (2E01 !== 20) { + throw new Test262Error('#2: 2E01 === 20'); +} + +//CHECK#3 +if (3E01 !== 30) { + throw new Test262Error('#3: 3E01 === 30'); +} + +//CHECK#4 +if (4E01 !== 40) { + throw new Test262Error('#4: 4E01 === 40'); +} + +//CHECK#5 +if (5E01 !== 50) { + throw new Test262Error('#5: 5E01 === 50'); +} + +//CHECK#6 +if (6E01 !== 60) { + throw new Test262Error('#6: 6E01 === 60'); +} + +//CHECK#7 +if (7E01 !== 70) { + throw new Test262Error('#7: 7E01 === 70'); +} + +//CHECK#8 +if (8E01 !== 80) { + throw new Test262Error('#8: 8E01 === 80'); +} + +//CHECK#9 +if (9E01 !== 90) { + throw new Test262Error('#9: 9E01 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T3.js new file mode 100644 index 0000000000..d5766009fe --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T3.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T3 +description: "ExponentIndicator :: e" +---*/ + +//CHECK#0 +if (0e-01 !== 0) { + throw new Test262Error('#0: 0e-01 === 0'); +} + +//CHECK#1 +if (1e-01 !== 0.1) { + throw new Test262Error('#1: 1e-01 === 0.1'); +} + +//CHECK#2 +if (2e-01 !== 0.2) { + throw new Test262Error('#2: 2e-01 === 0.2'); +} + +//CHECK#3 +if (3e-01 !== 0.3) { + throw new Test262Error('#3: 3e-01 === 0.3'); +} + +//CHECK#4 +if (4e-01 !== 0.4) { + throw new Test262Error('#4: 4e-01 === 0.4'); +} + +//CHECK#5 +if (5e-01 !== 0.5) { + throw new Test262Error('#5: 5e-01 === 0.5'); +} + +//CHECK#6 +if (6e-01 !== 0.6) { + throw new Test262Error('#6: 6e-01 === 0.6'); +} + +//CHECK#7 +if (7e-01 !== 0.7) { + throw new Test262Error('#7: 7e-01 === 0.7'); +} + +//CHECK#8 +if (8e-01 !== 0.8) { + throw new Test262Error('#8: 8e-01 === 0.8'); +} + +//CHECK#9 +if (9e-01 !== 0.9) { + throw new Test262Error('#9: 9e-01 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T4.js new file mode 100644 index 0000000000..1ae7a60f30 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T4.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T4 +description: "ExponentIndicator :: E" +---*/ + +//CHECK#0 +if (0E-01 !== 0) { + throw new Test262Error('#0: 0E-01 === 0'); +} + +//CHECK#1 +if (1E-01 !== 0.1) { + throw new Test262Error('#1: 1E-01 === 0.1'); +} + +//CHECK#2 +if (2E-01 !== 0.2) { + throw new Test262Error('#2: 2E-01 === 0.2'); +} + +//CHECK#3 +if (3E-01 !== 0.3) { + throw new Test262Error('#3: 3E-01 === 0.3'); +} + +//CHECK#4 +if (4E-01 !== 0.4) { + throw new Test262Error('#4: 4E-01 === 0.4'); +} + +//CHECK#5 +if (5E-01 !== 0.5) { + throw new Test262Error('#5: 5E-01 === 0.5'); +} + +//CHECK#6 +if (6E-01 !== 0.6) { + throw new Test262Error('#6: 6E-01 === 0.6'); +} + +//CHECK#7 +if (7E-01 !== 0.7) { + throw new Test262Error('#7: 7E-01 === 0.7'); +} + +//CHECK#8 +if (8E-01 !== 0.8) { + throw new Test262Error('#8: 8E-01 === 0.8'); +} + +//CHECK#9 +if (9E-01 !== 0.9) { + throw new Test262Error('#9: 9E-01 === 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T5.js new file mode 100644 index 0000000000..cff98be62d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T5 +description: "ExponentIndicator :: e" +---*/ + +//CHECK#0 +if (0e+01 !== 0) { + throw new Test262Error('#0: 0e+01 === 0'); +} + +//CHECK#1 +if (1e+01 !== 10) { + throw new Test262Error('#1: 1e+01 === 10'); +} + +//CHECK#2 +if (2e+01 !== 20) { + throw new Test262Error('#2: 2e+01 === 20'); +} + +//CHECK#3 +if (3e+01 !== 30) { + throw new Test262Error('#3: 3e+01 === 30'); +} + +//CHECK#4 +if (4e+01 !== 40) { + throw new Test262Error('#4: 4e+01 === 40'); +} + +//CHECK#5 +if (5e+01 !== 50) { + throw new Test262Error('#5: 5e+01 === 50'); +} + +//CHECK#6 +if (6e+01 !== 60) { + throw new Test262Error('#6: 6e+01 === 60'); +} + +//CHECK#7 +if (7e+01 !== 70) { + throw new Test262Error('#7: 7e+01 === 70'); +} + +//CHECK#8 +if (8e+01 !== 80) { + throw new Test262Error('#8: 8e+01 === 80'); +} + +//CHECK#9 +if (9e+01 !== 90) { + throw new Test262Error('#9: 9e+01 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T6.js new file mode 100644 index 0000000000..283738439c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T6.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T6 +description: "ExponentIndicator :: E" +---*/ + +//CHECK#0 +if (0E+01 !== 0) { + throw new Test262Error('#0: 0E+01 === 0'); +} + +//CHECK#1 +if (1E+01 !== 10) { + throw new Test262Error('#1: 1E+01 === 10'); +} + +//CHECK#2 +if (2E+01 !== 20) { + throw new Test262Error('#2: 2E+01 === 20'); +} + +//CHECK#3 +if (3E+01 !== 30) { + throw new Test262Error('#3: 3E+01 === 30'); +} + +//CHECK#4 +if (4E+01 !== 40) { + throw new Test262Error('#4: 4E+01 === 40'); +} + +//CHECK#5 +if (5E+01 !== 50) { + throw new Test262Error('#5: 5E+01 === 50'); +} + +//CHECK#6 +if (6E+01 !== 60) { + throw new Test262Error('#6: 6E+01 === 60'); +} + +//CHECK#7 +if (7E+01 !== 70) { + throw new Test262Error('#7: 7E+01 === 70'); +} + +//CHECK#8 +if (8E+01 !== 80) { + throw new Test262Error('#8: 8E+01 === 80'); +} + +//CHECK#9 +if (9E+01 !== 90) { + throw new Test262Error('#9: 9E+01 === 90'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T7.js new file mode 100644 index 0000000000..203a0d5755 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T7.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T7 +description: "ExponentIndicator :: e" +---*/ + +//CHECK#0 +if (0e00 !== 0) { + throw new Test262Error('#0: 0e00 === 0'); +} + +//CHECK#1 +if (1e00 !== 1) { + throw new Test262Error('#1: 1e00 === 1'); +} + +//CHECK#2 +if (2e00 !== 2) { + throw new Test262Error('#2: 2e00 === 2'); +} + +//CHECK#3 +if (3e00 !== 3) { + throw new Test262Error('#3: 3e00 === 3'); +} + +//CHECK#4 +if (4e00 !== 4) { + throw new Test262Error('#4: 4e00 === 4'); +} + +//CHECK#5 +if (5e00 !== 5) { + throw new Test262Error('#5: 5e00 === 5'); +} + +//CHECK#6 +if (6e00 !== 6) { + throw new Test262Error('#6: 6e00 === 6'); +} + +//CHECK#7 +if (7e00 !== 7) { + throw new Test262Error('#7: 7e00 === 7'); +} + +//CHECK#8 +if (8e00 !== 8) { + throw new Test262Error('#8: 8e00 === 8'); +} + +//CHECK#9 +if (9e00 !== 9) { + throw new Test262Error('#9: 9e00 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T8.js new file mode 100644 index 0000000000..3f78f22eb4 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A4.2_T8.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "ExponentPart :: ExponentIndicator ( /+/-) 0 DecimalDigits is allowed" +es5id: 7.8.3_A4.2_T8 +description: "ExponentIndicator :: E" +---*/ + +//CHECK#0 +if (0E00 !== 0) { + throw new Test262Error('#0: 0E00 === 0'); +} + +//CHECK#1 +if (1E00 !== 1) { + throw new Test262Error('#1: 1E00 === 1'); +} + +//CHECK#2 +if (2E00 !== 2) { + throw new Test262Error('#2: 2E00 === 2'); +} + +//CHECK#3 +if (3E00 !== 3) { + throw new Test262Error('#3: 3E00 === 3'); +} + +//CHECK#4 +if (4E00 !== 4) { + throw new Test262Error('#4: 4E00 === 4'); +} + +//CHECK#5 +if (5E00 !== 5) { + throw new Test262Error('#5: 5E00 === 5'); +} + +//CHECK#6 +if (6E00 !== 6) { + throw new Test262Error('#6: 6E00 === 6'); +} + +//CHECK#7 +if (7E00 !== 7) { + throw new Test262Error('#7: 7E00 === 7'); +} + +//CHECK#8 +if (8E00 !== 8) { + throw new Test262Error('#8: 8E00 === 8'); +} + +//CHECK#9 +if (9E00 !== 9) { + throw new Test262Error('#9: 9E00 === 9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T1.js new file mode 100644 index 0000000000..bade3bfa3e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T1.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T1 +description: "HexIntegerLiteral :: 0x Digit" +---*/ + +//CHECK#0 +if (0x0 !== 0) { + throw new Test262Error('#0: 0x0 === 0'); +} + +//CHECK#1 +if (0x1 !== 1) { + throw new Test262Error('#1: 0x1 === 1'); +} + +//CHECK#2 +if (0x2 !== 2) { + throw new Test262Error('#2: 0x2 === 2'); +} + +//CHECK#3 +if (0x3 !== 3) { + throw new Test262Error('#3: 0x3 === 3'); +} + +//CHECK#4 +if (0x4 !== 4) { + throw new Test262Error('#4: 0x4 === 4'); +} + +//CHECK#5 +if (0x5 !== 5) { + throw new Test262Error('#5: 0x5 === 5'); +} + +//CHECK#6 +if (0x6 !== 6) { + throw new Test262Error('#6: 0x6 === 6'); +} + +//CHECK#7 +if (0x7 !== 7) { + throw new Test262Error('#7: 0x7 === 7'); +} + +//CHECK#8 +if (0x8 !== 8) { + throw new Test262Error('#8: 0x8 === 8'); +} + +//CHECK#9 +if (0x9 !== 9) { + throw new Test262Error('#9: 0x9 === 9'); +} + +//CHECK#A +if (0xA !== 10) { + throw new Test262Error('#A: 0xA === 10'); +} + +//CHECK#B +if (0xB !== 11) { + throw new Test262Error('#B: 0xB === 11'); +} + +//CHECK#C +if (0xC !== 12) { + throw new Test262Error('#C: 0xC === 12'); +} + +//CHECK#D +if (0xD !== 13) { + throw new Test262Error('#D: 0xD === 13'); +} + +//CHECK#E +if (0xE !== 14) { + throw new Test262Error('#E: 0xE === 14'); +} + +//CHECK#F +if (0xF !== 15) { + throw new Test262Error('#F: 0xF === 15'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T2.js new file mode 100644 index 0000000000..2a7c77cfb1 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T2.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T2 +description: "HexIntegerLiteral :: 0X Digit" +---*/ + +//CHECK#0 +if (0X0 !== 0) { + throw new Test262Error('#0: 0X0 === 0'); +} + +//CHECK#1 +if (0X1 !== 1) { + throw new Test262Error('#1: 0X1 === 1'); +} + +//CHECK#2 +if (0X2 !== 2) { + throw new Test262Error('#2: 0X2 === 2'); +} + +//CHECK#3 +if (0X3 !== 3) { + throw new Test262Error('#3: 0X3 === 3'); +} + +//CHECK#4 +if (0X4 !== 4) { + throw new Test262Error('#4: 0X4 === 4'); +} + +//CHECK#5 +if (0X5 !== 5) { + throw new Test262Error('#5: 0X5 === 5'); +} + +//CHECK#6 +if (0X6 !== 6) { + throw new Test262Error('#6: 0X6 === 6'); +} + +//CHECK#7 +if (0X7 !== 7) { + throw new Test262Error('#7: 0X7 === 7'); +} + +//CHECK#8 +if (0X8 !== 8) { + throw new Test262Error('#8: 0X8 === 8'); +} + +//CHECK#9 +if (0X9 !== 9) { + throw new Test262Error('#9: 0X9 === 9'); +} + +//CHECK#A +if (0XA !== 10) { + throw new Test262Error('#A: 0XA === 10'); +} + +//CHECK#B +if (0XB !== 11) { + throw new Test262Error('#B: 0XB === 11'); +} + +//CHECK#C +if (0XC !== 12) { + throw new Test262Error('#C: 0XC === 12'); +} + +//CHECK#D +if (0XD !== 13) { + throw new Test262Error('#D: 0XD === 13'); +} + +//CHECK#E +if (0XE !== 14) { + throw new Test262Error('#E: 0XE === 14'); +} + +//CHECK#F +if (0XF !== 15) { + throw new Test262Error('#F: 0XF === 15'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T3.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T3.js new file mode 100644 index 0000000000..638d8a5c9b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T3.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T3 +description: "HexIntegerLiteral :: 0x NonZeroDigit Digits" +---*/ + +//CHECK#0 +if (0x0 !== 0) { + throw new Test262Error('#0: 0x0 === 0'); +} + +//CHECK#1 +if (0x1 !== 1) { + throw new Test262Error('#1: 0x1 === 1'); +} + +//CHECK#2 +if (0x10 !== 16) { + throw new Test262Error('#2: 0x10 === 16'); +} + +//CHECK3 +if (0x100 !== 256) { + throw new Test262Error('3: 0x100 === 256'); +} + +//CHECK#4 +if (0x1000 !== 4096) { + throw new Test262Error('#4: 0x1000 === 4096'); +} + +//CHECK#5 +if (0x10000 !== 65536) { + throw new Test262Error('#5: 0x10000 === 65536'); +} + +//CHECK#6 +if (0x100000 !== 1048576) { + throw new Test262Error('#6: 0x100000 === 1048576'); +} + +//CHECK#7 +if (0x1000000 !== 16777216) { + throw new Test262Error('#7: 0x1000000 === 16777216'); +} + +//CHECK#8 +if (0x10000000 !== 268435456) { + throw new Test262Error('#8: 0x10000000 === 268435456'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T4.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T4.js new file mode 100644 index 0000000000..4dbd2cf6be --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T4.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T4 +description: "HexIntegerLiteral :: 0X NonZeroDigit Digits" +---*/ + +//CHECK#0 +if (0X0 !== 0) { + throw new Test262Error('#0: 0X0 === 0'); +} + +//CHECK#1 +if (0X1 !== 1) { + throw new Test262Error('#1: 0X1 === 1'); +} + +//CHECK#2 +if (0X10 !== 16) { + throw new Test262Error('#2: 0X10 === 16'); +} + +//CHECK3 +if (0X100 !== 256) { + throw new Test262Error('3: 0X100 === 256'); +} + +//CHECK#4 +if (0X1000 !== 4096) { + throw new Test262Error('#4: 0X1000 === 4096'); +} + +//CHECK#5 +if (0X10000 !== 65536) { + throw new Test262Error('#5: 0X10000 === 65536'); +} + +//CHECK#6 +if (0X100000 !== 1048576) { + throw new Test262Error('#6: 0X100000 === 1048576'); +} + +//CHECK#7 +if (0X1000000 !== 16777216) { + throw new Test262Error('#7: 0X1000000 === 16777216'); +} + +//CHECK#8 +if (0X10000000 !== 268435456) { + throw new Test262Error('#8: 0X10000000 === 268435456'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T5.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T5.js new file mode 100644 index 0000000000..84a6134710 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T5 +description: "HexIntegerLiteral :: 0x0 Digits" +---*/ + +//CHECK#0 +if (0x00 !== 0) { + throw new Test262Error('#0: 0x00 === 0'); +} + +//CHECK#1 +if (0x01 !== 1) { + throw new Test262Error('#1: 0x01 === 1'); +} + +//CHECK#2 +if (0x010 !== 16) { + throw new Test262Error('#2: 0x010 === 16'); +} + +//CHECK3 +if (0x0100 !== 256) { + throw new Test262Error('3: 0x0100 === 256'); +} + +//CHECK#4 +if (0x01000 !== 4096) { + throw new Test262Error('#4: 0x01000 === 4096'); +} + +//CHECK#5 +if (0x010000 !== 65536) { + throw new Test262Error('#5: 0x010000 === 65536'); +} + +//CHECK#6 +if (0x0100000 !== 1048576) { + throw new Test262Error('#6: 0x0100000 === 1048576'); +} + +//CHECK#7 +if (0x01000000 !== 16777216) { + throw new Test262Error('#7: 0x01000000 === 16777216'); +} + +//CHECK#8 +if (0x010000000 !== 268435456) { + throw new Test262Error('#8: 0x010000000 === 268435456'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T6.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T6.js new file mode 100644 index 0000000000..76e24379f0 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T6.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T6 +description: "HexIntegerLiteral :: 0X0 Digits" +---*/ + +//CHECK#0 +if (0X00 !== 0) { + throw new Test262Error('#0: 0X00 === 0'); +} + +//CHECK#1 +if (0X01 !== 1) { + throw new Test262Error('#1: 0X01 === 1'); +} + +//CHECK#2 +if (0X010 !== 16) { + throw new Test262Error('#2: 0X010 === 16'); +} + +//CHECK3 +if (0X0100 !== 256) { + throw new Test262Error('3: 0X0100 === 256'); +} + +//CHECK#4 +if (0X01000 !== 4096) { + throw new Test262Error('#4: 0X01000 === 4096'); +} + +//CHECK#5 +if (0X010000 !== 65536) { + throw new Test262Error('#5: 0X010000 === 65536'); +} + +//CHECK#6 +if (0X0100000 !== 1048576) { + throw new Test262Error('#6: 0X0100000 === 1048576'); +} + +//CHECK#7 +if (0X01000000 !== 16777216) { + throw new Test262Error('#7: 0X01000000 === 16777216'); +} + +//CHECK#8 +if (0X010000000 !== 268435456) { + throw new Test262Error('#8: 0X010000000 === 268435456'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T7.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T7.js new file mode 100644 index 0000000000..cc9cb770db --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T7.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T7 +description: "HexIntegerLiteral :: 0x one of a, b, c, d, e, f" +---*/ + +//CHECK#a +if (0xa !== 10) { + throw new Test262Error('#a: 0xa === 10'); +} + +//CHECK#b +if (0xb !== 11) { + throw new Test262Error('#b: 0xb === 11'); +} + +//CHECK#c +if (0xc !== 12) { + throw new Test262Error('#c: 0xc === 12'); +} + +//CHECK#d +if (0xd !== 13) { + throw new Test262Error('#d: 0xd === 13'); +} + +//CHECK#e +if (0xe !== 14) { + throw new Test262Error('#e: 0xe === 14'); +} + +//CHECK#f +if (0xf !== 15) { + throw new Test262Error('#f: 0xf === 15'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T8.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T8.js new file mode 100644 index 0000000000..76d412fd99 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A5.1_T8.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "DecimalLiteral :: HexIntegerLiteral" +es5id: 7.8.3_A5.1_T8 +description: "HexIntegerLiteral :: 0X one of a, b, c, d, e, f" +---*/ + +//CHECK#a +if (0Xa !== 10) { + throw new Test262Error('#a: 0Xa === 10'); +} + +//CHECK#b +if (0Xb !== 11) { + throw new Test262Error('#b: 0Xb === 11'); +} + +//CHECK#c +if (0Xc !== 12) { + throw new Test262Error('#c: 0Xc === 12'); +} + +//CHECK#d +if (0Xd !== 13) { + throw new Test262Error('#d: 0Xd === 13'); +} + +//CHECK#e +if (0Xe !== 14) { + throw new Test262Error('#e: 0Xe === 14'); +} + +//CHECK#f +if (0Xf !== 15) { + throw new Test262Error('#f: 0Xf === 15'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T1.js new file mode 100644 index 0000000000..eb2a0d68d1 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "HexIntegerLiteral :: 0(x/X) is incorrect" +es5id: 7.8.3_A6.1_T1 +description: Checking if execution of "0x" passes +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +0x diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T2.js new file mode 100644 index 0000000000..36b4f06232 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.1_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "HexIntegerLiteral :: 0(x/X) is incorrect" +es5id: 7.8.3_A6.1_T2 +description: Checking if execution of "0X" passes +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +0X diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T1.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T1.js new file mode 100644 index 0000000000..72c9e31931 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: 0xG is incorrect +es5id: 7.8.3_A6.2_T1 +description: Checking if execution of "0xG" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +0xG diff --git a/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T2.js b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T2.js new file mode 100644 index 0000000000..bdbb44e13f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/S7.8.3_A6.2_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: 0xG is incorrect +es5id: 7.8.3_A6.2_T2 +description: Checking if execution of "0xg" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +0xg diff --git a/js/src/tests/test262/language/literals/numeric/binary-invalid-digit.js b/js/src/tests/test262/language/literals/numeric/binary-invalid-digit.js new file mode 100644 index 0000000000..6686982745 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary-invalid-digit.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Binary-integer-literal-like sequence containing an invalid digit +info: | + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigit :: one of + 0 1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0b2; diff --git a/js/src/tests/test262/language/literals/numeric/binary-invalid-leading.js b/js/src/tests/test262/language/literals/numeric/binary-invalid-leading.js new file mode 100644 index 0000000000..3389211f68 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary-invalid-leading.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Binary-integer-literal-like sequence with a leading 0 +info: | + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigit :: one of + 0 1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +00b0; diff --git a/js/src/tests/test262/language/literals/numeric/binary-invalid-truncated.js b/js/src/tests/test262/language/literals/numeric/binary-invalid-truncated.js new file mode 100644 index 0000000000..e5e1428f0e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary-invalid-truncated.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Binary-integer-literal-like sequence without any digits +info: | + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigit :: one of + 0 1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0b; diff --git a/js/src/tests/test262/language/literals/numeric/binary-invalid-unicode.js b/js/src/tests/test262/language/literals/numeric/binary-invalid-unicode.js new file mode 100644 index 0000000000..e6ec183806 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary-invalid-unicode.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Binary-integer-literal-like sequence expressed with unicode escape sequence +info: | + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigit :: one of + 0 1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0\u00620; diff --git a/js/src/tests/test262/language/literals/numeric/binary.js b/js/src/tests/test262/language/literals/numeric/binary.js new file mode 100644 index 0000000000..703e64bd14 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/binary.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3.1 +description: Mathematical value of valid binary integer literals +info: | + The MV of BinaryIntegerLiteral :: 0b BinaryDigits is the MV of + BinaryDigits. + The MV of BinaryIntegerLiteral :: 0B BinaryDigits is the MV of + BinaryDigits. + The MV of BinaryDigits :: BinaryDigit is the MV of BinaryDigit. + The MV of BinaryDigits :: BinaryDigits BinaryDigit is (the MV of + BinaryDigits × 2) plus the MV of BinaryDigit. +---*/ + +assert.sameValue(0b0, 0, 'lower-case head'); +assert.sameValue(0B0, 0, 'upper-case head'); +assert.sameValue(0b00, 0, 'lower-case head with leading zeros'); +assert.sameValue(0B00, 0, 'upper-case head with leading zeros'); + +assert.sameValue(0b1, 1, 'lower-case head'); +assert.sameValue(0B1, 1, 'upper-case head'); +assert.sameValue(0b01, 1, 'lower-case head with leading zeros'); +assert.sameValue(0B01, 1, 'upper-case head with leading zeros'); + +assert.sameValue(0b10, 2, 'lower-case head'); +assert.sameValue(0B10, 2, 'upper-case head'); +assert.sameValue(0b010, 2, 'lower-case head with leading zeros'); +assert.sameValue(0B010, 2, 'upper-case head with leading zeros'); + +assert.sameValue(0b11, 3, 'lower-case head'); +assert.sameValue(0B11, 3, 'upper-case head'); +assert.sameValue(0b011, 3, 'lower-case head with leading zeros'); +assert.sameValue(0B011, 3, 'upper-case head with leading zeros'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/browser.js b/js/src/tests/test262/language/literals/numeric/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/browser.js diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integer-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integer-strict-strict.js new file mode 100644 index 0000000000..485c78172c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integer-strict-strict.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-numeric-literals +description: LegacyOctalIntegerLiteral is not enabled in strict mode code +info: | + NumericLiteral :: + DecimalLiteral + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + LegacyOctalIntegerLiteral + + LegacyOctalIntegerLiteral :: + 0 OctalDigit + LegacyOctalIntegerLiteral OctalDigit + + ## 12.8.3.1 Static Semantics: Early Errors + + NumericLiteral :: LegacyOctalIntegerLiteral + DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral + + - It is a Syntax Error if the source code matching this production is + strict mode code. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +00; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integer.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integer.js new file mode 100644 index 0000000000..aba9fb5866 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integer.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-numeric-literals +description: Mathematical value for LegacyOctalIntegerLiteral +info: | + NumericLiteral :: + DecimalLiteral + BinaryIntegerLiteral + OctalIntegerLiteral + HexIntegerLiteral + LegacyOctalIntegerLiteral + + LegacyOctalIntegerLiteral :: + 0 OctalDigit + LegacyOctalIntegerLiteral OctalDigit +flags: [noStrict] +---*/ + +// LegacyOctalIntegerLiteral :: +// 0 OctalDigit +assert.sameValue(00, 0, '00'); +assert.sameValue(01, 1, '01'); +assert.sameValue(02, 2, '02'); +assert.sameValue(03, 3, '03'); +assert.sameValue(04, 4, '04'); +assert.sameValue(05, 5, '05'); +assert.sameValue(06, 6, '06'); +assert.sameValue(07, 7, '07'); + +// LegacyOctalIntegerLiteral :: +// LegacyOctalIntegerLiteral OctalDigit +assert.sameValue(000, 0, '000'); +assert.sameValue(001, 1, '001'); +assert.sameValue(002, 2, '002'); +assert.sameValue(003, 3, '003'); +assert.sameValue(004, 4, '004'); +assert.sameValue(005, 5, '005'); +assert.sameValue(006, 6, '006'); +assert.sameValue(007, 7, '007'); + +assert.sameValue(070, 56); +assert.sameValue(071, 57); +assert.sameValue(072, 58); +assert.sameValue(073, 59); +assert.sameValue(074, 60); +assert.sameValue(075, 61); +assert.sameValue(076, 62); +assert.sameValue(077, 63); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-000-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-000-strict-strict.js new file mode 100644 index 0000000000..a326471ba6 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-000-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-6-s +description: Strict Mode - octal extension (000) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +000; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-005-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-005-strict-strict.js new file mode 100644 index 0000000000..de9a6d702b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-005-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-7-s +description: Strict Mode - octal extension (005) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +005; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-01-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-01-strict-strict.js new file mode 100644 index 0000000000..d7d62d64d3 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-01-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-3-s +description: Strict Mode - octal extension (01) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +01; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-010-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-010-strict-strict.js new file mode 100644 index 0000000000..41de0398b4 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-010-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-1-s +description: Strict Mode - octal extension (010) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +010; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-06-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-06-strict-strict.js new file mode 100644 index 0000000000..706920d538 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-06-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-4-s +description: Strict Mode - octal extension (06) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +06; diff --git a/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-07-strict-strict.js b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-07-strict-strict.js new file mode 100644 index 0000000000..0238a5d60f --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/legacy-octal-integery-07-strict-strict.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.3-5-s +description: Strict Mode - octal extension (07) is forbidden in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +07; diff --git a/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer-strict-strict.js b/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer-strict-strict.js new file mode 100644 index 0000000000..59b0f802d6 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer-strict-strict.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-numeric-literals +description: NonOctalDecimalIntegerLiteral is not enabled in strict mode code +info: | + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigits[opt] + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit :: one of + 8 9 + + ## 12.8.3.1 Static Semantics: Early Errors + + NumericLiteral :: LegacyOctalIntegerLiteral + DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral + + - It is a Syntax Error if the source code matching this production is + strict mode code. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +08; diff --git a/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer.js b/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer.js new file mode 100644 index 0000000000..e8ec539f21 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/non-octal-decimal-integer.js @@ -0,0 +1,121 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-numeric-literals +description: Mathematical value for NonOctalDecimalIntegerLiteral +info: | + DecimalIntegerLiteral :: + 0 + NonZeroDigit DecimalDigits[opt] + NonOctalDecimalIntegerLiteral + + NonOctalDecimalIntegerLiteral :: + 0 NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + 0 OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + NonOctalDigit :: one of + 8 9 +flags: [noStrict] +---*/ + +// NonOctalDecimalIntegerLiteral :: +// 0 NonOctalDigit +assert.sameValue(08, 8, '08'); +assert.sameValue(09, 9, '09'); + +// NonOctalDecimalIntegerLiteral :: +// LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit +assert.sameValue(008, 8, '008'); +assert.sameValue(018, 18, '018'); +assert.sameValue(028, 28, '028'); +assert.sameValue(038, 38, '038'); +assert.sameValue(048, 48, '048'); +assert.sameValue(058, 58, '058'); +assert.sameValue(068, 68, '068'); +assert.sameValue(078, 78, '078'); +assert.sameValue(088, 88, '088'); +assert.sameValue(098, 98, '098'); +assert.sameValue(0708, 708, '708'); +assert.sameValue(0718, 718, '718'); +assert.sameValue(0728, 728, '728'); +assert.sameValue(0738, 738, '738'); +assert.sameValue(0748, 748, '748'); +assert.sameValue(0758, 758, '758'); +assert.sameValue(0768, 768, '768'); +assert.sameValue(0778, 778, '778'); +assert.sameValue(0788, 788, '788'); +assert.sameValue(0798, 798, '798'); + +assert.sameValue(009, 9, '009'); +assert.sameValue(019, 19, '019'); +assert.sameValue(029, 29, '029'); +assert.sameValue(039, 39, '039'); +assert.sameValue(049, 49, '049'); +assert.sameValue(059, 59, '059'); +assert.sameValue(069, 69, '069'); +assert.sameValue(079, 79, '079'); +assert.sameValue(089, 89, '089'); +assert.sameValue(099, 99, '099'); +assert.sameValue(0709, 709, '0709'); +assert.sameValue(0719, 719, '0719'); +assert.sameValue(0729, 729, '0729'); +assert.sameValue(0739, 739, '0739'); +assert.sameValue(0749, 749, '0749'); +assert.sameValue(0759, 759, '0759'); +assert.sameValue(0769, 769, '0769'); +assert.sameValue(0779, 779, '0779'); +assert.sameValue(0789, 789, '0789'); +assert.sameValue(0799, 799, '0799'); + +// NonOctalDecimalIntegerLiteral :: +// NonOctalDecimalIntegerLiteral DecimalDigit +assert.sameValue(080, 80, '080'); +assert.sameValue(081, 81, '081'); +assert.sameValue(082, 82, '082'); +assert.sameValue(083, 83, '083'); +assert.sameValue(084, 84, '084'); +assert.sameValue(085, 85, '085'); +assert.sameValue(086, 86, '086'); +assert.sameValue(087, 87, '087'); +assert.sameValue(088, 88, '088'); +assert.sameValue(089, 89, '089'); + +assert.sameValue(0780, 780, '0780'); +assert.sameValue(0781, 781, '0781'); +assert.sameValue(0782, 782, '0782'); +assert.sameValue(0783, 783, '0783'); +assert.sameValue(0784, 784, '0784'); +assert.sameValue(0785, 785, '0785'); +assert.sameValue(0786, 786, '0786'); +assert.sameValue(0787, 787, '0787'); +assert.sameValue(0788, 788, '0788'); +assert.sameValue(0789, 789, '0789'); + +assert.sameValue(090, 90, '090'); +assert.sameValue(091, 91, '091'); +assert.sameValue(092, 92, '092'); +assert.sameValue(093, 93, '093'); +assert.sameValue(094, 94, '094'); +assert.sameValue(095, 95, '095'); +assert.sameValue(096, 96, '096'); +assert.sameValue(097, 97, '097'); +assert.sameValue(098, 98, '098'); +assert.sameValue(099, 99, '099'); + +assert.sameValue(0790, 790, '0790'); +assert.sameValue(0791, 791, '0791'); +assert.sameValue(0792, 792, '0792'); +assert.sameValue(0793, 793, '0793'); +assert.sameValue(0794, 794, '0794'); +assert.sameValue(0795, 795, '0795'); +assert.sameValue(0796, 796, '0796'); +assert.sameValue(0797, 797, '0797'); +assert.sameValue(0798, 798, '0798'); +assert.sameValue(0799, 799, '0799'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-followed-by-ident.js b/js/src/tests/test262/language/literals/numeric/numeric-followed-by-ident.js new file mode 100644 index 0000000000..d4b0d41529 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-followed-by-ident.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Mozilla. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-numeric-literals +description: > + NumericLiteral followed by IdentifierStart +info: | + The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit. + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +3in [] diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/browser.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/browser.js diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js new file mode 100644 index 0000000000..51787b6282 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0b` | `0B` in a + BinaryIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b_1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js new file mode 100644 index 0000000000..f00a1b4244 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(0b0_1, 0b01); +assert.sameValue(0B0_1, 0B01); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js new file mode 100644 index 0000000000..c5bc6ceaa4 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bd-nsl-bds.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(0b0_10, 0b010); +assert.sameValue(0B0_10, 0B010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js new file mode 100644 index 0000000000..a1f65b2427 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(0b01_0, 0b010); +assert.sameValue(0B01_0, 0B010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js new file mode 100644 index 0000000000..13d7e59684 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-bds-nsl-bds.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(0b01_00, 0b0100); +assert.sameValue(0B01_00, 0B0100); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js new file mode 100644 index 0000000000..776f3f7479 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-dunder-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a BinaryIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b0__0 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js new file mode 100644 index 0000000000..2aa643f897 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-bil-nsl-bd-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + BinaryIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + BinaryIntegerLiteral :: + 0b BinaryDigits + 0B BinaryDigits + + BinaryDigits :: + BinaryDigit + BinaryDigits BinaryDigit + BinaryDigits NumericLiteralSeparator BinaryDigit + + BinaryDigit :: one of + 0 1 + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0b0_ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js new file mode 100644 index 0000000000..1e73a38078 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dd-nsl-dd.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + SignedInteger :: + ... + - DecimalDigits + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1.0e-1_0, 1.0e-10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js new file mode 100644 index 0000000000..cffca45eb8 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-minus-dds-nsl-dd.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + DecimalDigits `.` DecimalDigits ExponentPart_opt `-` DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + SignedInteger :: + ... + - DecimalDigits + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1.0e-10_0, 1.0e-100); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js new file mode 100644 index 0000000000..116c8541f7 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dd-nsl-dd.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + SignedInteger :: + ... + + DecimalDigits + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1.0e+1_0, 1.0e+10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js new file mode 100644 index 0000000000..a80cc8dfab --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-dot-dd-ep-sign-plus-dds-nsl-dd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + DecimalDigits `.` DecimalDigits ExponentPart_opt `+` DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + SignedInteger :: + ... + + DecimalDigits + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1.0e+10_0, 1.0e+100); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js new file mode 100644 index 0000000000..1de1863fc1 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dd-one-of.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + + DecimalDigits :: + DecimalDigit + ... + + DecimalDigit :: one of + 0 1 2 3 4 5 6 7 8 9 + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1_0, 10); +assert.sameValue(1_1, 11); +assert.sameValue(1_2, 12); +assert.sameValue(1_3, 13); +assert.sameValue(1_4, 14); +assert.sameValue(1_5, 15); +assert.sameValue(1_6, 16); +assert.sameValue(1_7, 17); +assert.sameValue(1_8, 18); +assert.sameValue(1_9, 19); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..dacdaa8a01 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-dds-dunder-err.js @@ -0,0 +1,27 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a DecimalIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1__0123456789 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-err.js new file mode 100644 index 0000000000..131058047b --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dd-nsl-err.js @@ -0,0 +1,29 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1_ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js new file mode 100644 index 0000000000..33c08b310c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-dot-dd-nsl-dd-ep-dd.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + DecimalDigits `.` DecimalDigits NumericLiteralSeparator DecimalDigits + ExponentPart SignedInteger +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(10.00_01e2, 10.0001e2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dd.js new file mode 100644 index 0000000000..30f2f323ed --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dd.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: DecimalDigits NumericLiteralSeparator DecimalDigit +info: | + NumericLiteralSeparator :: + _ + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(123456789_0, 1234567890); +assert.sameValue(123456789_1, 1234567891); +assert.sameValue(123456789_2, 1234567892); +assert.sameValue(123456789_3, 1234567893); +assert.sameValue(123456789_4, 1234567894); +assert.sameValue(123456789_5, 1234567895); +assert.sameValue(123456789_6, 1234567896); +assert.sameValue(123456789_7, 1234567897); +assert.sameValue(123456789_8, 1234567898); +assert.sameValue(123456789_9, 1234567899); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..226c3dd37c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-dds-dunder-err.js @@ -0,0 +1,27 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in DecimalIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10__0123456789 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-err.js new file mode 100644 index 0000000000..85da0a51ee --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dds-nsl-err.js @@ -0,0 +1,30 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + DecimalLiteral +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10_ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-dds-nsl-ep-dd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-dds-nsl-ep-dd-err.js new file mode 100644 index 0000000000..d5c9e826ae --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-dds-nsl-ep-dd-err.js @@ -0,0 +1,29 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10.0_e1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-dd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-dd-err.js new file mode 100644 index 0000000000..5edda2bb20 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-dd-err.js @@ -0,0 +1,29 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be adjacent to `.` +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10._1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-ep-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-ep-err.js new file mode 100644 index 0000000000..983493cdcb --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-ep-err.js @@ -0,0 +1,32 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear between `.` and ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10._e1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-err.js new file mode 100644 index 0000000000..945ff12dab --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dil-dot-nsl-err.js @@ -0,0 +1,30 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + DecimalLiteral +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + DecimalIntegerLiteral . DecimalDigits_opt ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +10._ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dd-ep.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dd-ep.js new file mode 100644 index 0000000000..e5d762fe89 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dd-ep.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `.` DecimalDigit NumericLiteralSeparator DecimalDigit ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + DecimalDigit + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(.0_1e2, .01e2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dds-ep.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dds-ep.js new file mode 100644 index 0000000000..79ff43a088 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dd-nsl-dds-ep.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `.` DecimalDigit NumericLiteralSeparator DecimalDigits ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + DecimalDigit + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(.1_01e2, .101e2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dd-ep.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dd-ep.js new file mode 100644 index 0000000000..ebe3f3a1dd --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dd-ep.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `.` DecimalDigits NumericLiteralSeparator DecimalDigit ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + DecimalDigit + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(.10_1e2, .101e2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dds-ep.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dds-ep.js new file mode 100644 index 0000000000..4b0183f351 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-dds-ep.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: > + `.` DecimalDigits NumericLiteralSeparator DecimalDigits ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + DecimalDigit + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(.00_01e2, .0001e2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-ep-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-ep-err.js new file mode 100644 index 0000000000..6b193eaaad --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-dds-nsl-ep-err.js @@ -0,0 +1,31 @@ +// |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: prod-NumericLiteralSeparator +description: NumericLiteralSeparator may not appear adjacent to ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +.0_e1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-ep-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-ep-err.js new file mode 100644 index 0000000000..f47aa6ed58 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-ep-err.js @@ -0,0 +1,32 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear between `.` and ExponentPart +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + + ExponentIndicator :: one of + e E + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +._e1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-err.js new file mode 100644 index 0000000000..cc385aef6c --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-dot-nsl-err.js @@ -0,0 +1,30 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + DecimalLiteral, nor adjacent to `.` +info: | + NumericLiteralSeparator :: + _ + + DecimalLiteral :: + . DecimalDigits ExponentPart_opt + + DecimalDigits :: + ... + DecimalDigits NumericLiteralSeparator DecimalDigit + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +._ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js new file mode 100644 index 0000000000..ddbc8bfda1 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0x` | `0X` in a + HexIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x_1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js new file mode 100644 index 0000000000..fa6449bf89 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0x0_1, 0x01); +assert.sameValue(0X0_1, 0X01); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js new file mode 100644 index 0000000000..f9e409b746 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hd-nsl-hds.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0x0_10, 0x010); +assert.sameValue(0X0_10, 0X010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js new file mode 100644 index 0000000000..8e24e295df --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0x01_0, 0x010); +assert.sameValue(0X01_0, 0X010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js new file mode 100644 index 0000000000..a34be03180 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-hds-nsl-hds.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0x01_00, 0x0100); +assert.sameValue(0X01_00, 0X0100); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js new file mode 100644 index 0000000000..5cccc79d08 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-dunder-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a HexIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x0__0 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js new file mode 100644 index 0000000000..4a60e15780 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-nsl-hd-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of a + HexIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0x0_ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js new file mode 100644 index 0000000000..9778115bce --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-hil-od-nsl-od-one-of.js @@ -0,0 +1,50 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0x0_0, 0x00); +assert.sameValue(0x1_1, 0x11); +assert.sameValue(0x2_2, 0x22); +assert.sameValue(0x3_3, 0x33); +assert.sameValue(0x4_4, 0x44); +assert.sameValue(0x5_5, 0x55); +assert.sameValue(0x6_6, 0x66); +assert.sameValue(0x7_7, 0x77); +assert.sameValue(0x8_8, 0x88); +assert.sameValue(0x9_9, 0x99); +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/numeric/numeric-separators/numeric-separator-literal-lol-00-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-00-err.js new file mode 100644 index 0000000000..cef8c58112 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-00-err.js @@ -0,0 +1,42 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +00_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-01-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-01-err.js new file mode 100644 index 0000000000..bcc260ee5a --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-01-err.js @@ -0,0 +1,42 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +01_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-07-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-07-err.js new file mode 100644 index 0000000000..3bb6753a59 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-07-err.js @@ -0,0 +1,44 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +07_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_0-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_0-err.js new file mode 100644 index 0000000000..231d8a0fdf --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_0-err.js @@ -0,0 +1,42 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_1-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_1-err.js new file mode 100644 index 0000000000..ccf0fae763 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_1-err.js @@ -0,0 +1,42 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_1; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_7-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_7-err.js new file mode 100644 index 0000000000..f2c43e158a --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-lol-0_7-err.js @@ -0,0 +1,43 @@ +// |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: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_7; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-08-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-08-err.js new file mode 100644 index 0000000000..abde825447 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-08-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 must not be in a NonOctalDecimalIntegerLiteral (08) +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +08_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-09-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-09-err.js new file mode 100644 index 0000000000..2c297e87e7 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-09-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 must not be in a NonOctalDecimalIntegerLiteral (09) +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +09_0; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_8-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_8-err.js new file mode 100644 index 0000000000..e4a948f9ad --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_8-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 must not be in a NonOctalDecimalIntegerLiteral (0_8) +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_8; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_9-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_9-err.js new file mode 100644 index 0000000000..a631aa1d4e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nonoctal-0_9-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 must not be in a NonOctalDecimalIntegerLiteral (0_9) +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_9; diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js new file mode 100644 index 0000000000..6aa81e7690 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd-one-of.js @@ -0,0 +1,41 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(1_0, 10); +assert.sameValue(1_1, 11); +assert.sameValue(2_2, 22); +assert.sameValue(3_3, 33); +assert.sameValue(4_4, 44); +assert.sameValue(5_5, 55); +assert.sameValue(6_6, 66); +assert.sameValue(7_7, 77); +assert.sameValue(8_8, 88); +assert.sameValue(9_9, 99); + + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js new file mode 100644 index 0000000000..8f77c5ad8a --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dd.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigit +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + + DecimalDigits :: + ... + DecimalDigits DecimalDigit + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1_1, 11); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js new file mode 100644 index 0000000000..0b7fba0d11 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-dunder-err.js @@ -0,0 +1,30 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in DecimalIntegerLiteral +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0__0123456789 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js new file mode 100644 index 0000000000..9c90918f21 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.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: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0_0123456789 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js new file mode 100644 index 0000000000..f133c9ee81 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-nzd-nsl-dds.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: NonZeroDigit NumericLiteralSeparator DecimalDigits +info: | + NumericLiteralSeparator :: + _ + + DecimalIntegerLiteral :: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + + NonZeroDigit :: one of + 1 2 3 4 5 6 7 8 9 + + DecimalDigits :: + ... + DecimalDigits DecimalDigit + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(1_0123456789, 10123456789); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js new file mode 100644 index 0000000000..2aa07a7963 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-dunder-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not appear adjacent to another + NumericLiteralSeparator in a OctalIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o0__0 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js new file mode 100644 index 0000000000..491f86a0b0 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-nsl-od-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the last digit character of an + OctalIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o0_ diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js new file mode 100644 index 0000000000..0ab03195cd --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-err.js @@ -0,0 +1,35 @@ +// |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: prod-NumericLiteralSeparator +description: > + NumericLiteralSeparator may not be the appear adjacent to `0o` | `0O` in a + OctalIntegerLiteral +info: | + 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: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +0o_1 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js new file mode 100644 index 0000000000..1beed1bd6e --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od-one-of.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0o0_0, 0o00); +assert.sameValue(0o1_1, 0o11); +assert.sameValue(0o2_2, 0o22); +assert.sameValue(0o3_3, 0o33); +assert.sameValue(0o4_4, 0o44); +assert.sameValue(0o5_5, 0o55); +assert.sameValue(0o6_6, 0o66); +assert.sameValue(0o7_7, 0o77); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js new file mode 100644 index 0000000000..f6151df531 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-od.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0o0_1, 0o01); +assert.sameValue(0O0_1, 0O01); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js new file mode 100644 index 0000000000..10902300a4 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-od-nsl-ods.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0o0_10, 0o010); +assert.sameValue(0O0_10, 0O010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js new file mode 100644 index 0000000000..676194f917 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-od.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0o01_0, 0o010); +assert.sameValue(0O01_0, 0O010); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js new file mode 100644 index 0000000000..0330fa6136 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-oil-ods-nsl-ods.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. 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: | + 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: [numeric-separator-literal] +---*/ + +assert.sameValue(0o01_00, 0o0100); +assert.sameValue(0O01_00, 0O0100); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js new file mode 100644 index 0000000000..683badcf54 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-minus-dds-nsl-dd.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: DecimalDigits NumericLiteralSeparator DecimalDigit +info: | + NumericLiteralSeparator :: + _ + + SignedInteger :: + ... + - DecimalDigits + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(-123456789_0, -1234567890); +assert.sameValue(-123456789_1, -1234567891); +assert.sameValue(-123456789_2, -1234567892); +assert.sameValue(-123456789_3, -1234567893); +assert.sameValue(-123456789_4, -1234567894); +assert.sameValue(-123456789_5, -1234567895); +assert.sameValue(-123456789_6, -1234567896); +assert.sameValue(-123456789_7, -1234567897); +assert.sameValue(-123456789_8, -1234567898); +assert.sameValue(-123456789_9, -1234567899); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-plus-dds-nsl-dd.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-plus-dds-nsl-dd.js new file mode 100644 index 0000000000..dcc9e845c1 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-sign-plus-dds-nsl-dd.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-NumericLiteralSeparator +description: DecimalDigits NumericLiteralSeparator DecimalDigit +info: | + NumericLiteralSeparator :: + _ + + SignedInteger :: + ... + + DecimalDigits + ... + +features: [numeric-separator-literal] +---*/ + +assert.sameValue(+123456789_0, 1234567890); +assert.sameValue(+123456789_1, 1234567891); +assert.sameValue(+123456789_2, 1234567892); +assert.sameValue(+123456789_3, 1234567893); +assert.sameValue(+123456789_4, 1234567894); +assert.sameValue(+123456789_5, 1234567895); +assert.sameValue(+123456789_6, 1234567896); +assert.sameValue(+123456789_7, 1234567897); +assert.sameValue(+123456789_8, 1234567898); +assert.sameValue(+123456789_9, 1234567899); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-unicode-err.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-unicode-err.js new file mode 100644 index 0000000000..aa84c40f7d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/numeric-separator-literal-unicode-err.js @@ -0,0 +1,27 @@ +// |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: prod-NumericLiteralSeparator +description: > + NonZeroDigit NumericLiteralSeparator DecimalDigits sequence expressed with + unicode escape sequence +info: | + NumericLiteralSeparator:: + _ + + DecimalIntegerLiteral:: + ... + NonZeroDigit NumericLiteralSeparator_opt DecimalDigits + +negative: + phase: parse + type: SyntaxError + +features: [numeric-separator-literal] +---*/ + +$DONOTEVALUATE(); + +1\u005F0123456789 diff --git a/js/src/tests/test262/language/literals/numeric/numeric-separators/shell.js b/js/src/tests/test262/language/literals/numeric/numeric-separators/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/numeric-separators/shell.js diff --git a/js/src/tests/test262/language/literals/numeric/octal-invalid-digit.js b/js/src/tests/test262/language/literals/numeric/octal-invalid-digit.js new file mode 100644 index 0000000000..3121c6f866 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/octal-invalid-digit.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Octal-integer-literal-like sequence containing an invalid digit +info: | + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigit :: one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0o8; diff --git a/js/src/tests/test262/language/literals/numeric/octal-invalid-leading.js b/js/src/tests/test262/language/literals/numeric/octal-invalid-leading.js new file mode 100644 index 0000000000..bd632ba739 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/octal-invalid-leading.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Octal-integer-literal-like sequence with a leading 0 +info: | + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigit :: one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +00o0; diff --git a/js/src/tests/test262/language/literals/numeric/octal-invalid-truncated.js b/js/src/tests/test262/language/literals/numeric/octal-invalid-truncated.js new file mode 100644 index 0000000000..e915f7f2d6 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/octal-invalid-truncated.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Octal-integer-literal-like sequence without any digits +info: | + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigit :: one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0o; diff --git a/js/src/tests/test262/language/literals/numeric/octal-invalid-unicode.js b/js/src/tests/test262/language/literals/numeric/octal-invalid-unicode.js new file mode 100644 index 0000000000..7b7197149d --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/octal-invalid-unicode.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3 +description: Octal-integer-literal-like sequence expressed with unicode escape sequence +info: | + OctalIntegerLiteral :: + 0o OctalDigits + 0O OctalDigits + OctalDigits :: + OctalDigit + OctalDigits OctalDigit + OctalDigit :: one of + 0 1 2 3 4 5 6 7 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0\u006f0; diff --git a/js/src/tests/test262/language/literals/numeric/octal.js b/js/src/tests/test262/language/literals/numeric/octal.js new file mode 100644 index 0000000000..81fb91e432 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/octal.js @@ -0,0 +1,47 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 11.8.3.1 +description: Mathematical value of valid octal integer literals +info: | + The MV of StrNumericLiteral ::: OctalIntegerLiteral is the MV of + OctalIntegerLiteral. + The MV of OctalIntegerLiteral :: 0o OctalDigits is the MV of OctalDigits. + The MV of OctalIntegerLiteral :: 0O OctalDigits is the MV of OctalDigits. + The MV of OctalDigits :: OctalDigit is the MV of OctalDigit. + The MV of OctalDigits :: OctalDigits OctalDigit is (the MV of OctalDigits × + 8) plus the MV of OctalDigit. +---*/ + +assert.sameValue(0o0, 0, 'lower-case head'); +assert.sameValue(0O0, 0, 'upper-case head'); +assert.sameValue(0o00, 0, 'lower-case head with leading zeros'); +assert.sameValue(0O00, 0, 'upper-case head with leading zeros'); + +assert.sameValue(0o1, 1, 'lower-case head'); +assert.sameValue(0O1, 1, 'upper-case head'); +assert.sameValue(0o01, 1, 'lower-case head with leading zeros'); +assert.sameValue(0O01, 1, 'upper-case head with leading zeros'); + +assert.sameValue(0o7, 7, 'lower-case head'); +assert.sameValue(0O7, 7, 'upper-case head'); +assert.sameValue(0o07, 7, 'lower-case head with leading zeros'); +assert.sameValue(0O07, 7, 'upper-case head with leading zeros'); + +assert.sameValue(0o10, 8, 'lower-case head'); +assert.sameValue(0O10, 8, 'upper-case head'); +assert.sameValue(0o010, 8, 'lower-case head with leading zeros'); +assert.sameValue(0O010, 8, 'upper-case head with leading zeros'); + +assert.sameValue(0o11, 9, 'lower-case head'); +assert.sameValue(0O11, 9, 'upper-case head'); +assert.sameValue(0o011, 9, 'lower-case head with leading zeros'); +assert.sameValue(0O011, 9, 'upper-case head with leading zeros'); + +assert.sameValue(0o77, 63, 'lower-case head'); +assert.sameValue(0O77, 63, 'upper-case head'); +assert.sameValue(0o077, 63, 'lower-case head with leading zeros'); +assert.sameValue(0O077, 63, 'upper-case head with leading zeros'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/numeric/shell.js b/js/src/tests/test262/language/literals/numeric/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/numeric/shell.js diff --git a/js/src/tests/test262/language/literals/regexp/7.8.5-1.js b/js/src/tests/test262/language/literals/regexp/7.8.5-1.js new file mode 100644 index 0000000000..8eacd910c9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/7.8.5-1.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + SyntaxError exception is thrown if the RegularExpressionNonTerminator position of a + RegularExpressionBackslashSequence is a LineTerminator. +description: > + A RegularExpressionBackslashSequence may not contain a LineTerminator. +---*/ + +assert.throws(SyntaxError, function() { + eval("/\\\rn/;"); +/* + +The result of this string is: + +"/\ +n/;" + +*/ +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/7.8.5-1gs.js b/js/src/tests/test262/language/literals/regexp/7.8.5-1gs.js new file mode 100644 index 0000000000..567cb28010 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/7.8.5-1gs.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionLiteral :: + / RegularExpressionBody / RegularExpressionFlags + + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + SourceCharacter :: + any Unicode code point + + RegularExpressionNonTerminator:: + SourceCharacter but not LineTerminator + +description: > + RegularExpressionBody will never be empty, because RegularExpressionFirstChar must always be _something_. // is a comment. +---*/ + +var y = 42; +var x = //.source; +y; + +assert.sameValue(x, y); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/7.8.5-2gs.js b/js/src/tests/test262/language/literals/regexp/7.8.5-2gs.js new file mode 100644 index 0000000000..f9b1d3f6b9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/7.8.5-2gs.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.5-2gs +description: Empty dynamic RegExp should not result in a SyntaxError +---*/ + +var re = new RegExp(""); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T1.js new file mode 100644 index 0000000000..ff1c5f83ab --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionFirstChar :: NonTerminator but not * or \ or /, + RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty] +es5id: 7.8.5_A1.1_T1 +description: Without eval +---*/ + +//CHECK#1 +if (/1/.source !== "1") { + throw new Test262Error('#1: /1/'); +} + +//CHECK#2 +if (/a/.source !== "a") { + throw new Test262Error('#2: /a/'); +} + +//CHECK#3 +if (/;/.source !== ";") { + throw new Test262Error('#3: /;/'); +} + +//CHECK#4 +if (/ /.source !== " ") { + throw new Test262Error('#4: / /'); +} + +//CHECK#5 +if (/\u0041/.source !== "\\u0041") { + throw new Test262Error('#5: /\\u0041/'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T2.js new file mode 100644 index 0000000000..08383b6495 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.1_T2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionFirstChar :: NonTerminator but not * or \ or /, + RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty] +es5id: 7.8.5_A1.1_T2 +description: Complex test with eval, using syntax pattern +---*/ + +for (var cu = 0; cu <= 0xffff; ++cu) { + var Elimination = + ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) || + (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) || + (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D)); + /* + * \u002A / \u002F \ \u005C + \u002B + ? \u003F ( \u0028 ) \u0029 + [ \u005B ] \u005D { \u007B } \u007D + */ + var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029)); + if ((Elimination || LineTerminator ) === false) { + var xx = String.fromCharCode(cu); + var pattern = eval("/" + xx + "/"); + assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T1.js new file mode 100644 index 0000000000..21f3e624cb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionFirstChar +info: | + RegularExpressionChars :: + [empty] + RegularExpressionCharsRegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + +description: > + The first character of a regular expression may not be "*" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/*/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T2.js new file mode 100644 index 0000000000..16c3d38d71 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T2.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + +description: > + The first character of a regular expression may not be "\" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T3.js new file mode 100644 index 0000000000..891aaa9c1f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T3.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + +description: > + The first character of a regular expression may not be "/" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/// +.source; diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T4.js new file mode 100644 index 0000000000..008979ed1a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.2_T4.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionLiteral:: + / RegularExpressionBody / RegularExpressionFlags + + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars:: + [empty] + + MemberExpression . IdentifierName + +description: A regular expression may not be empty. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +// +.source; diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T1.js new file mode 100644 index 0000000000..5264fd86b1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T1.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LF> (\u000A) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T2.js new file mode 100644 index 0000000000..4919cb6498 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LF> (\u000A), evaluated +---*/ + +//CHECK#1 +try { + eval("/\u000A/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: Line Feed is incorrect. Actual: ' + (eval("/\u000A/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: Line Feed is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T3.js new file mode 100644 index 0000000000..11fd813618 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T3.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <CR>, (\u000D) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T4.js new file mode 100644 index 0000000000..e22f4e21be --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T4.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <CR>, (\u000D), evaluated +---*/ + +//CHECK#1 +try { + eval("/\u000D/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: Carriage Return is incorrect. Actual: ' + (eval("/\u000D/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: Carriage Return is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T5.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T5.js new file mode 100644 index 0000000000..2111c61459 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T5.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LS>, (\u2028), evaluated + +---*/ + +//CHECK#1 +try { + eval("/\u2028/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: Line separator is incorrect. Actual: ' + (eval("/\u2028/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: Line separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T6.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T6.js new file mode 100644 index 0000000000..e004a50813 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.3_T6.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LS>, (\u2028), evaluated +---*/ + +//CHECK#1 +try { + eval("/\u2029/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: Paragraph separator is incorrect. Actual: ' + (eval("/\u2029/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: Paragraph separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T1.js new file mode 100644 index 0000000000..018d8d463c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionFirstChar :: BackslashSequence :: \NonTerminator, + RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty] +es5id: 7.8.5_A1.4_T1 +description: Check similar to (/\;/.source === "\\;") +---*/ + +//CHECK#1 +if (/\;/.source !== "\\;") { + throw new Test262Error('#1: /\\;/'); +} + +//CHECK#2 +if (/\ /.source !== "\\ ") { + throw new Test262Error('#2: /\\ /'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T2.js new file mode 100644 index 0000000000..528e414400 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.4_T2.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionFirstChar :: BackslashSequence :: \NonTerminator, + RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty] +es5id: 7.8.5_A1.4_T2 +description: Complex test with eval, using syntax pattern +---*/ + +for (var cu = 0; cu <= 0xffff; ++cu) { + var Elimination = + ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) || + (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) || + (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D)); + /* + * \u002A / \u002F \ \u005C + \u002B + ? \u003F ( \u0028 ) \u0029 + [ \u005B ] \u005D { \u007B } \u007D + */ + var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029)); + if ((Elimination || LineTerminator ) === false) { + var xx = "\\" + String.fromCharCode(cu); + try { + var pattern = eval("/" + xx + "/"); + } catch (e) { + var identifierPartNotUnicodeIDContinue = ((cu === 0x0024) || (cu === 0x200C) || (cu === 0x200D)); + if (e instanceof SyntaxError && !identifierPartNotUnicodeIDContinue) { + // Use eval with var-declaration to check if `cu` is in UnicodeIDContinue. + try { + eval("var _" + String.fromCharCode(cu)); + continue; + } catch (ignore) { } + } + throw e; + } + assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T1.js new file mode 100644 index 0000000000..0de1c6a6a9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T1.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A RegularExpressionBackslashSequence may not contain a <LF> + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T2.js new file mode 100644 index 0000000000..45adbfaec4 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A RegularExpressionBackslashSequence may not contain a <LF>, evaluated + +---*/ + +//CHECK#1 +try { + eval("/\\\u000A/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/\\\u000A/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T3.js new file mode 100644 index 0000000000..d4003bf348 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T3.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A RegularExpressionBackslashSequence may not contain a <CR> +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T4.js new file mode 100644 index 0000000000..b5962c12b3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A RegularExpressionBackslashSequence may not contain a <CR>, evaluated +---*/ + +//CHECK#1 +try { + eval("/\\\u000D/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/\\\u000D/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T5.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T5.js new file mode 100644 index 0000000000..86e90a5744 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T5.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LS>, (\u2028), evaluated +---*/ + +//CHECK#1 +try { + eval("/\\\u2028/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/\\\u2028/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T6.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T6.js new file mode 100644 index 0000000000..5fb0b9b08c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A1.5_T6.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <PS>, (\u2029), evaluated +---*/ + +//CHECK#1 +try { + eval("/\\\u2029/").source; + throw new Test262Error('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/\\\u2029/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionFirstChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T1.js new file mode 100644 index 0000000000..9cad6dddc3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionChar :: NonTerminator but not \ or /, + RegularExpressionFlags :: [empty] +es5id: 7.8.5_A2.1_T1 +description: Without eval +---*/ + +//CHECK#1 +if (/1a/.source !== "1a") { + throw new Test262Error('#1: /1a/'); +} + +//CHECK#2 +if (/aa/.source !== "aa") { + throw new Test262Error('#2: /aa/'); +} + +//CHECK#3 +if (/,;/.source !== ",;") { + throw new Test262Error('#3: /,;/'); +} + +//CHECK#4 +if (/ /.source !== " ") { + throw new Test262Error('#4: / /'); +} + +//CHECK#5 +if (/a\u0041/.source !== "a\\u0041") { + throw new Test262Error('#5: /a\\u0041/'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T2.js new file mode 100644 index 0000000000..d077c89fed --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.1_T2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionChar :: NonTerminator but not \ or /, + RegularExpressionFlags :: [empty] +es5id: 7.8.5_A2.1_T2 +description: Complex test with eval, using syntax pattern +---*/ + +for (var cu = 0; cu <= 0xffff; ++cu) { + var Elimination = + ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) || + (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) || + (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D)); + /* + * \u002A / \u002F \ \u005C + \u002B + ? \u003F ( \u0028 ) \u0029 + [ \u005B ] \u005D { \u007B } \u007D + */ + var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029)); + if ((Elimination || LineTerminator ) === false) { + var xx = "nnnn" + String.fromCharCode(cu); + var pattern = eval("/" + xx + "/"); + assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T1.js new file mode 100644 index 0000000000..603b348ecf --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionChar +info: | + RegularExpressionChar :: + RegularExpressionNonTerminator but not one of \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A regular express may not contain a "\" as a SourceCharacter + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a\/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T2.js new file mode 100644 index 0000000000..96682b6af1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.2_T2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionChar +info: | + RegularExpressionChar :: + RegularExpressionNonTerminator but not one of \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A regular expression may not contain a "/" as a SourceCharacter + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a//.source; diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T1.js new file mode 100644 index 0000000000..1f463af56c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T1.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionChar :: + RegularExpressionBackslashSequence + + + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LF> as a SourceCharacter +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T2.js new file mode 100644 index 0000000000..a63f1777c9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionChar :: + RegularExpressionBackslashSequence + + + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LF> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\u000A/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: Line Feedis incorrect. Actual: ' + (eval("/a\u000A/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: Line Feed is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T3.js new file mode 100644 index 0000000000..5bf93016ab --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T3.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionChar :: + RegularExpressionBackslashSequence + + + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <CR> as a SourceCharacter + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T4.js new file mode 100644 index 0000000000..e04f5f5622 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T4.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-regular-expression-literals +info: | + RegularExpressionChar :: + RegularExpressionBackslashSequence + + + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <CR> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\u000D/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: Carriage Retur is incorrect. Actual: ' + (eval("/a\u000D/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: Carriage Retur is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T5.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T5.js new file mode 100644 index 0000000000..e4643f98bc --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T5.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A regular expression may not contain a <LS> as a SourceCharacter, evaluated + +---*/ + +//CHECK#1 +try { + eval("/a\u2028/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: Line separator is incorrect. Actual: ' + (eval("/a\u2028/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: Line separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T6.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T6.js new file mode 100644 index 0000000000..3985c50fbd --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.3_T6.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A regular expression may not contain a <PS> as a SourceCharacter, evaluated + +---*/ + +try { + eval("/s\u2029/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: Paragraph separator is incorrect. Actual: ' + (eval("/s\u2029/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: Paragraph separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T1.js new file mode 100644 index 0000000000..cc4668832c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionChar :: BackslashSequence :: \NonTerminator, + RegularExpressionFlags :: [empty] +es5id: 7.8.5_A2.4_T1 +description: Check similar to (/,\;/.source === ",\\;") +---*/ + +//CHECK#1 +if (/,\;/.source !== ",\\;") { + throw new Test262Error('#1: /,\\;/'); +} + +//CHECK#2 +if (/ \ /.source !== " \\ ") { + throw new Test262Error('#2: / \\ /'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T2.js new file mode 100644 index 0000000000..565997cd92 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.4_T2.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + RegularExpressionChar :: BackslashSequence :: \NonTerminator, + RegularExpressionFlags :: [empty] +es5id: 7.8.5_A2.4_T2 +description: Complex test with eval, using syntax pattern +---*/ + +for (var cu = 0; cu <= 0xffff; ++cu) { + var Elimination = + ((cu === 0x002A) || (cu === 0x002F) || (cu === 0x005C) || (cu === 0x002B) || + (cu === 0x003F) || (cu === 0x0028) || (cu === 0x0029) || + (cu === 0x005B) || (cu === 0x005D) || (cu === 0x007B) || (cu === 0x007D)); + /* + * \u002A / \u002F \ \u005C + \u002B + ? \u003F ( \u0028 ) \u0029 + [ \u005B ] \u005D { \u007B } \u007D + */ + var LineTerminator = ((cu === 0x000A) || (cu === 0x000D) || (cu === 0x2028) || (cu === 0x2029)); + if ((Elimination || LineTerminator ) === false) { + var xx = "a\\" + String.fromCharCode(cu); + try { + var pattern = eval("/" + xx + "/"); + } catch (e) { + var identifierPartNotUnicodeIDContinue = ((cu === 0x0024) || (cu === 0x200C) || (cu === 0x200D)); + if (e instanceof SyntaxError && !identifierPartNotUnicodeIDContinue) { + // Use eval with var-declaration to check if `cu` is in UnicodeIDContinue. + try { + eval("var _" + String.fromCharCode(cu)); + continue; + } catch (ignore) { } + } + throw e; + } + assert.sameValue(pattern.source, xx, "Code unit: " + cu.toString(16)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T1.js new file mode 100644 index 0000000000..7599dabd48 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T1.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LF> as a SourceCharacter +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a\ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T2.js new file mode 100644 index 0000000000..d7e66cb046 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LF> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\\\u000A/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/a\\\u000A/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T3.js new file mode 100644 index 0000000000..8f1329314c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T3.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <CR> as a SourceCharacter +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a\ +/ diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T4.js new file mode 100644 index 0000000000..fbdfbc62c2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LF> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\\\u000D/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/a\\\u000D/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T5.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T5.js new file mode 100644 index 0000000000..2bbcd18acf --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T5.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LS> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\\\u2028/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/a\\\u2028/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T6.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T6.js new file mode 100644 index 0000000000..538a786925 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A2.5_T6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <PS> as a SourceCharacter, evaluated +---*/ + +//CHECK#1 +try { + eval("/a\\\u2029/").source; + throw new Test262Error('#1.1: RegularExpressionChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/a\\\u2029/").source)); +} +catch (e) { + if ((e instanceof SyntaxError) !== true) { + throw new Test262Error('#1.2: RegularExpressionChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T1.js new file mode 100644 index 0000000000..2719ec3f46 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T1 +description: "IdentifierPart :: g" +---*/ + +//CHECK#1 +var regexp = /(?:)/g; +if (regexp.global !== true) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === true. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== false) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === false. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== false) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === false. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T2.js new file mode 100644 index 0000000000..02f9a8edbf --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T2 +description: "IdentifierPart :: i" +---*/ + +//CHECK#1 +var regexp = /(?:)/i; +if (regexp.global !== false) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === false. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== true) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === true. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== false) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === false. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T3.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T3.js new file mode 100644 index 0000000000..d349d6e765 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T3 +description: "IdentifierPart :: m" +---*/ + +//CHECK#1 +var regexp = /(?:)/m; +if (regexp.global !== false) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === false. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== false) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === false. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== true) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === true. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T4.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T4.js new file mode 100644 index 0000000000..0449010aa3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T4 +description: "IdentifierPart :: gi" +---*/ + +//CHECK#1 +var regexp = /(?:)/gi; +if (regexp.global !== true) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === true. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== true) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === true. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== false) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === false. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T5.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T5.js new file mode 100644 index 0000000000..3e3f649fa1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T5.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T5 +description: "IdentifierPart :: mg" +---*/ + +//CHECK#1 +var regexp = /(?:)/mg; +if (regexp.global !== true) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === true. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== false) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === false. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== true) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === true. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T6.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T6.js new file mode 100644 index 0000000000..1f66426320 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A3.1_T6.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "RegularExpressionFlags :: IdentifierPart" +es5id: 7.8.5_A3.1_T6 +description: "IdentifierPart :: mig" +---*/ + +//CHECK#1 +var regexp = /(?:)/mig; +if (regexp.global !== true) { + throw new Test262Error('#1: var regexp = /(?:)/g; regexp.global === true. Actual: ' + (regexp.global)); +} + +//CHECK#2 +if (regexp.ignoreCase !== true) { + throw new Test262Error('#2: var regexp = /(?:)/g; regexp.ignoreCase === true. Actual: ' + (regexp.ignoreCase)); +} + +//CHECK#3 +if (regexp.multiline !== true) { + throw new Test262Error('#3: var regexp = /(?:)/g; regexp.multiline === true. Actual: ' + (regexp.multiline)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.1.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.1.js new file mode 100644 index 0000000000..8de2e9dd27 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A regular expression literal is an input element that is converted to + a RegExp object when it is scanned +es5id: 7.8.5_A4.1 +description: "Check ((/(?:)/ instanceof RegExp) === true)" +---*/ + +//CHECK#1 +if ((/(?:)/ instanceof RegExp) !== true) { + throw new Test262Error('#1: (/(?:)/ instanceof RegExp) === true. Actual: ' + ((/(?:)/ instanceof RegExp))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.2.js b/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.2.js new file mode 100644 index 0000000000..b58263a0f2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/S7.8.5_A4.2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Two regular expression literals in a program evaluate to + regular expression objects that never compare as === to each other even + if the two literals' contents are identical +es5id: 7.8.5_A4.2 +description: Check equality two regular expression literals +---*/ + +var regexp1 = /(?:)/; +var regexp2 = /(?:)/; +assert.notSameValue( + regexp1, + regexp2, + "var regexp1 = /(?:)/; var regexp2 = /(?:)/; regexp1 !== regexp2" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/browser.js b/js/src/tests/test262/language/literals/regexp/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/browser.js diff --git a/js/src/tests/test262/language/literals/regexp/early-err-bad-flag.js b/js/src/tests/test262/language/literals/regexp/early-err-bad-flag.js new file mode 100644 index 0000000000..03b86899d4 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/early-err-bad-flag.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: | + PrimaryExpression : RegularExpressionLiteral + +description: > + It is a Syntax Error if FlagText of RegularExpressionLiteral contains any code points other than "g", "i", "m", "u", or "y", ... + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/./G; diff --git a/js/src/tests/test262/language/literals/regexp/early-err-dup-flag.js b/js/src/tests/test262/language/literals/regexp/early-err-dup-flag.js new file mode 100644 index 0000000000..d169db2de2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/early-err-dup-flag.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: | + PrimaryExpression : RegularExpressionLiteral + +description: > + It is a Syntax Error if FlagText of RegularExpressionLiteral contains ... the same code point more than once. + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/./gig; diff --git a/js/src/tests/test262/language/literals/regexp/early-err-flags-unicode-escape.js b/js/src/tests/test262/language/literals/regexp/early-err-flags-unicode-escape.js new file mode 100644 index 0000000000..618cc1685e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/early-err-flags-unicode-escape.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-regular-expression-literals-static-semantics-early-errors +info: | + RegularExpressionFlags :: + RegularExpressionFlags IdentifierPart + +description: > + It is a Syntax Error if IdentifierPart contains a Unicode escape sequence. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/./\u0067; diff --git a/js/src/tests/test262/language/literals/regexp/early-err-pattern.js b/js/src/tests/test262/language/literals/regexp/early-err-pattern.js new file mode 100644 index 0000000000..52760381ae --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/early-err-pattern.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors +info: | + PrimaryExpression : RegularExpressionLiteral + +description: > + It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be recognized using the goal symbol Pattern of the ECMAScript RegExp grammar specified in #sec-patterns. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/?/; diff --git a/js/src/tests/test262/language/literals/regexp/inequality.js b/js/src/tests/test262/language/literals/regexp/inequality.js new file mode 100644 index 0000000000..ab355e70a6 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/inequality.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Regular expression literals should not compare as equal even if they appear in the same source position. +esid: sec-regular-expression-literals-runtime-semantics-evaluation +---*/ + +function makeRegExp() { + return /(?:)/; +} + +assert.notSameValue(makeRegExp(), makeRegExp()); + +var values = []; +for (var i = 0; i < 2; ++i) { + values[i] = /(?:)/; +} + +assert.notSameValue(values[0], values[1]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-exact.js b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-exact.js new file mode 100644 index 0000000000..af8c227ee9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-exact.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Braced quantifier in an Atom position (exact count) +info: | + SyntaxCharacter :: one of + ^$\.*+?()[]{}| + + PatternCharacter :: + SourceCharacter but not SyntaxCharacter + + Although Annex B extends the definition of Term to include + ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier + pattern with a higher precedence. This makes the SyntaxError for such + patterns consistent between Annex-B and non-Annex-B environments. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/{2}/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-lower.js b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-lower.js new file mode 100644 index 0000000000..04c09bc675 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-lower.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Braced quantifier in an Atom position (lower-bounds) +info: | + SyntaxCharacter :: one of + ^$\.*+?()[]{}| + + PatternCharacter :: + SourceCharacter but not SyntaxCharacter + + Although Annex B extends the definition of Term to include + ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier + pattern with a higher precedence. This makes the SyntaxError for such + patterns consistent between Annex-B and non-Annex-B environments. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/{2,}/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-range.js b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-range.js new file mode 100644 index 0000000000..b7066f93f3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-braced-quantifier-range.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Braced quantifier in an Atom position (range) +info: | + SyntaxCharacter :: one of + ^$\.*+?()[]{}| + + PatternCharacter :: + SourceCharacter but not SyntaxCharacter + + Although Annex B extends the definition of Term to include + ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier + pattern with a higher precedence. This makes the SyntaxError for such + patterns consistent between Annex-B and non-Annex-B environments. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/{2,3}/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-optional-lookbehind.js b/js/src/tests/test262/language/literals/regexp/invalid-optional-lookbehind.js new file mode 100644 index 0000000000..418769eb9f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-optional-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<=.)?/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-optional-negative-lookbehind.js b/js/src/tests/test262/language/literals/regexp/invalid-optional-negative-lookbehind.js new file mode 100644 index 0000000000..432227f13e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-optional-negative-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<!.)?/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-range-lookbehind.js b/js/src/tests/test262/language/literals/regexp/invalid-range-lookbehind.js new file mode 100644 index 0000000000..4877a59dc2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-range-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<=.){2,3}/; diff --git a/js/src/tests/test262/language/literals/regexp/invalid-range-negative-lookbehind.js b/js/src/tests/test262/language/literals/regexp/invalid-range-negative-lookbehind.js new file mode 100644 index 0000000000..355fe20d78 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/invalid-range-negative-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<!.){2,3}/; diff --git a/js/src/tests/test262/language/literals/regexp/lastIndex.js b/js/src/tests/test262/language/literals/regexp/lastIndex.js new file mode 100644 index 0000000000..2e9d03590a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/lastIndex.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expression-literals-runtime-semantics-evaluation +description: Initial state of the `lastIndex` property +info: | + [...] + 3. Return RegExpCreate(pattern, flags). + + 21.2.3.2.3 Runtime Semantics: RegExpCreate + + 1. Let obj be ? RegExpAlloc(%RegExp%). + 2. Return ? RegExpInitialize(obj, P, F). + + 21.2.3.2.2 Runtime Semantics: RegExpInitialize + + [...] + 12. Perform ? Set(obj, "lastIndex", 0, true). + [...] + + 21.2.3.2.1 Runtime Semantics: RegExpAlloc + + [...] + 2. Perform ! DefinePropertyOrThrow(obj, "lastIndex", PropertyDescriptor + {[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}). + [...] +includes: [propertyHelper.js] +---*/ + +var re = /./; + +assert.sameValue(re.lastIndex, 0); + +verifyNotEnumerable(re, 'lastIndex'); +verifyWritable(re, 'lastIndex'); +verifyNotConfigurable(re, 'lastIndex'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator-eval.js b/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator-eval.js new file mode 100644 index 0000000000..67f7efaaa8 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator-eval.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in regular expression literals (eval code). +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +assert.sameValue(eval("/\u180E/").source, "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator.js b/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator.js new file mode 100644 index 0000000000..d34c22c09f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/mongolian-vowel-separator.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in regular expression literals. +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +// U+180E in regular expressions; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue(//.source, "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/browser.js b/js/src/tests/test262/language/literals/regexp/named-groups/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/browser.js diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/forward-reference.js b/js/src/tests/test262/language/literals/regexp/named-groups/forward-reference.js new file mode 100644 index 0000000000..2f8588f751 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/forward-reference.js @@ -0,0 +1,12 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Named groups can be forward references. +esid: sec-atomescape +features: [regexp-named-groups] +---*/ + +assert(/\k<a>(?<a>x)/.test("x")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js new file mode 100644 index 0000000000..52c85bb005 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)\k<ab>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js new file mode 100644 index 0000000000..98acd42120 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)\k<ab>/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js new file mode 100644 index 0000000000..ab2512d83e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<ab>a)\k<a>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js new file mode 100644 index 0000000000..9995ddaed8 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<ab>a)\k<a>/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js new file mode 100644 index 0000000000..c2a97ae631 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a>(?<ab>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js new file mode 100644 index 0000000000..f410a00797 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a>(?<ab>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js new file mode 100644 index 0000000000..d42ee9e35c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a>(?<b>x)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-u.js new file mode 100644 index 0000000000..f30c4f8aa7 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-u.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<b>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js new file mode 100644 index 0000000000..3598f94426 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname.js new file mode 100644 index 0000000000..ca192d22e1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-dangling-groupname.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<b>/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js new file mode 100644 index 0000000000..5019ab119f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifiers within one alternative must be unique. +info: | + It is a Syntax Error if |Pattern| contains two distinct |GroupSpecifier|s + _x_ and _y_ for which CapturingGroupName(_x_) is the same as + CapturingGroupName(_y_) and such that CanBothParticipate(_x_, _y_) is *true*. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)(?<b>b)(?<a>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js new file mode 100644 index 0000000000..8ed19cedc5 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifiers within one alternative must be unique. +info: | + It is a Syntax Error if |Pattern| contains two distinct |GroupSpecifier|s + _x_ and _y_ for which CapturingGroupName(_x_) is the same as + CapturingGroupName(_y_) and such that CanBothParticipate(_x_, _y_) is *true*. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)(?<b>b)(?<a>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js new file mode 100644 index 0000000000..efc8218273 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifiers within one alternative must be unique. +info: | + It is a Syntax Error if |Pattern| contains two distinct |GroupSpecifier|s + _x_ and _y_ for which CapturingGroupName(_x_) is the same as + CapturingGroupName(_y_) and such that CanBothParticipate(_x_, _y_) is *true*. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)(?<a>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js new file mode 100644 index 0000000000..628eb10a82 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifiers within one alternative must be unique. +info: | + It is a Syntax Error if |Pattern| contains two distinct |GroupSpecifier|s + _x_ and _y_ for which CapturingGroupName(_x_) is the same as + CapturingGroupName(_y_) and such that CanBothParticipate(_x_, _y_) is *true*. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>a)(?<a>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js new file mode 100644 index 0000000000..83a09b9956 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js new file mode 100644 index 0000000000..90f4ee1afb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js new file mode 100644 index 0000000000..0bb1f1327e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>\a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js new file mode 100644 index 0000000000..2eba873154 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<a/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js new file mode 100644 index 0000000000..f100d3f1f3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<a/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js new file mode 100644 index 0000000000..c0a550e311 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js new file mode 100644 index 0000000000..261544e03f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k<>/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js new file mode 100644 index 0000000000..93d9a6a8fb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a(?<a>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js new file mode 100644 index 0000000000..9ae652fbfc --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a(?<a>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js new file mode 100644 index 0000000000..2053830a01 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k(?<a>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js new file mode 100644 index 0000000000..3a74d7d7e0 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js new file mode 100644 index 0000000000..21f0d481a8 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<>/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js new file mode 100644 index 0000000000..0d5ddc0ca9 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js new file mode 100644 index 0000000000..717ee16c2a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/\k<a/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname.js new file mode 100644 index 0000000000..7487e008c1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-incomplete-groupname.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupName is `< RegExpIdentifierName >`. +esid: prod-GroupName +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a>.)\k/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js new file mode 100644 index 0000000000..c279b25900 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Lone surrogates in RegExp group names +esid: prod-GroupSpecifier +features: [regexp-named-groups] +---*/ + +assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/"), "Lead"); +assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/"), "Trail"); +assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/u"), "Lead with u flag"); +assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/u"), "Trail with u flag"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js new file mode 100644 index 0000000000..d7bcc1770a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\>.)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js new file mode 100644 index 0000000000..4dfa419755 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js new file mode 100644 index 0000000000..38807e1c86 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<$❞>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js new file mode 100644 index 0000000000..230092e8ef --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<𐒤>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js new file mode 100644 index 0000000000..b25da28a84 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<𐒤>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js new file mode 100644 index 0000000000..289bc4ca5c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\uD83D\uDF12>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js new file mode 100644 index 0000000000..0dacb1134d --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\uD801>.)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js new file mode 100644 index 0000000000..92e0e30821 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\uD801>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js new file mode 100644 index 0000000000..44249276ea --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\uDCA4>.)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js new file mode 100644 index 0000000000..90df2cc5b5 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\uDCA4>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js new file mode 100644 index 0000000000..bb2f21ee55 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\u{1F08B}>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js new file mode 100644 index 0000000000..8ebbc51ea1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\u{10FFFF}>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js new file mode 100644 index 0000000000..e2f9d21f68 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<\>.)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js new file mode 100644 index 0000000000..63777657b1 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<\>.)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js new file mode 100644 index 0000000000..4002519fd0 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a\u{110000}>.)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js new file mode 100644 index 0000000000..82cc67c825 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<❤>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js new file mode 100644 index 0000000000..3958b2d282 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<❤>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js new file mode 100644 index 0000000000..4f31018512 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<42a>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js new file mode 100644 index 0000000000..19244144bc --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<42a>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js new file mode 100644 index 0000000000..5128e74e8a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<:a>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js new file mode 100644 index 0000000000..e22331acdb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<:a>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js new file mode 100644 index 0000000000..b9d7fcba6c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a:>a)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js new file mode 100644 index 0000000000..08d11b25dc --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<a:>a)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js new file mode 100644 index 0000000000..fc8cfd4a8e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<aa)/u; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js new file mode 100644 index 0000000000..e2c7bdb4fb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +$DONOTEVALUATE(); + +/(?<aa)/; diff --git a/js/src/tests/test262/language/literals/regexp/named-groups/shell.js b/js/src/tests/test262/language/literals/regexp/named-groups/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/named-groups/shell.js diff --git a/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-line-separator.js b/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-line-separator.js new file mode 100644 index 0000000000..b6222bb8b7 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-line-separator.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <LS> +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/
/ + +/* +There is a <LS> between the two / characters +*/ diff --git a/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-paragraph-separator.js b/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-paragraph-separator.js new file mode 100644 index 0000000000..ef25939c6e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/regexp-first-char-no-paragraph-separator.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + The first character of a regular expression may not be a <PS> +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/
/ + +/* +There is a <PS> between the two / characters +*/ diff --git a/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-line-separator.js b/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-line-separator.js new file mode 100644 index 0000000000..2174c1ea73 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-line-separator.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionBackslashSequence +info: | + RegularExpressionBackslashSequence :: + \ RegularExpressionNonTerminator + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + + LineTerminator :: + <LF> + <CR> + <LS> + <PS> + +description: > + A regular expression may not contain a <LS> as a SourceCharacter +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a\\
/ + +/* +There is a <LS> between "a\\
" and "/" +*/ diff --git a/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-paragraph-separator.js b/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-paragraph-separator.js new file mode 100644 index 0000000000..13643f5206 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/regexp-source-char-no-paragraph-separator.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-RegularExpressionNonTerminator +info: | + RegularExpressionBody :: + RegularExpressionFirstChar RegularExpressionChars + + RegularExpressionChars :: + [empty] + RegularExpressionChars RegularExpressionChar + + RegularExpressionFirstChar :: + RegularExpressionNonTerminator but not one of * or \ or / or [ + + RegularExpressionNonTerminator :: + SourceCharacter but not LineTerminator + +description: > + A regular expression may not contain a <PS> as a SourceCharacter +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/a\\
/ + +/* +There is a <PS> between "a\\
" and "/" +*/ diff --git a/js/src/tests/test262/language/literals/regexp/shell.js b/js/src/tests/test262/language/literals/regexp/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/shell.js diff --git a/js/src/tests/test262/language/literals/regexp/u-astral-char-class-invert.js b/js/src/tests/test262/language/literals/regexp/u-astral-char-class-invert.js new file mode 100644 index 0000000000..17d8dddaaa --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-astral-char-class-invert.js @@ -0,0 +1,33 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-atom +description: > + Literal astral symbols within inverted CharacterClass. +info: | + The production Atom :: CharacterClass evaluates as follows: + + 1. Evaluate CharacterClass to obtain a CharSet A and a Boolean invert. + 2. Call CharacterSetMatcher(A, invert, direction) and return its Matcher result. + + Runtime Semantics: CharacterSetMatcher ( A, invert, direction ) + + 1. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps: + [...] + f. Let cc be Canonicalize(ch). + g. If invert is false, then + [...] + h. Else, + i. Assert: invert is true. + ii. If there exists a member a of set A such that Canonicalize(a) is cc, + return failure. +---*/ + +assert.sameValue(/^[^❤️]$/u.exec("❤️"), null); +assert.sameValue(/^[^🧡]/u.exec("🧡"), null); +assert.sameValue(/[^💛]$/u.exec("💛"), null); +assert.sameValue(/[^💚]/u.exec("💚"), null); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-astral.js b/js/src/tests/test262/language/literals/regexp/u-astral.js new file mode 100644 index 0000000000..70ab2b3cc6 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-astral.js @@ -0,0 +1,57 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Literal astral symbols within a pattern +es6id: 21.2.2.8.2 +info: | + 21.2.2.2 Pattern + + The production Pattern :: Disjunction evaluates as follows: + + 1. Evaluate Disjunction to obtain a Matcher m. + 2. Return an internal closure that takes two arguments, a String str + and an integer index, and performs the following steps: + 1. If Unicode is true, let Input be a List consisting of the + sequence of code points of str interpreted as a UTF-16 encoded + (6.1.4) Unicode string. Otherwise, let Input be a List consisting + of the sequence of code units that are the elements of str. Input + will be used throughout the algorithms in 21.2.2. Each element of + Input is considered to be a character. +---*/ + +assert(/𝌆{2}/u.test('𝌆𝌆'), 'quantifier application'); + +assert(/^[𝌆]$/u.test('𝌆'), 'as a ClassAtom'); + +var rangeRe = /[💩-💫]/u; +assert.sameValue( + rangeRe.test('\ud83d\udca8'), + false, + 'ClassAtom as lower range boundary, input below (U+1F4A8)' +); +assert.sameValue( + rangeRe.test('\ud83d\udca9'), + true, + 'ClassAtom as lower range boundary, input match (U+1F4A9)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcaa'), + true, + 'ClassAtom as upper- and lower-range boundary, input within (U+1F4AA)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcab'), + true, + 'ClassAtom as upper range boundary, input match (U+1F4AB)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcac'), + false, + 'ClassAtom as upper range boundary, input above (U+1F4AC)' +); + +assert(/[^𝌆]/u.test('\ud834'), 'Negated character classes (LeadSurrogate)'); +assert(/[^𝌆]/u.test('\udf06'), 'Negated character classes (TrailSurrogate)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-case-mapping.js b/js/src/tests/test262/language/literals/regexp/u-case-mapping.js new file mode 100644 index 0000000000..2ac4e2d64f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-case-mapping.js @@ -0,0 +1,51 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Case mapping of astral symbols +es6id: 21.2.2.8.2 +info: | + 21.2.2.8.2 Runtime Semantics: Canonicalize ( ch ) + + The abstract operation Canonicalize takes a character parameter ch and + performs the following steps: + + 1. If IgnoreCase is false, return ch. + 2. If Unicode is true, + a. If the file CaseFolding.txt of the Unicode Character Database + provides a simple or common case folding mapping for ch, return + the result of applying that mapping to ch. + b. Else, return ch. +---*/ + +assert.sameValue( + /\u212a/i.test('k'), + false, + 'Case mapping is not applied in the absence of the `u` flag' +); +assert.sameValue( + /\u212a/i.test('K'), + false, + 'Case mapping is not applied in the absence of the `u` flag' +); +assert.sameValue( + /\u212a/u.test('k'), + false, + 'Case mapping is not applied in the absence of the `i` flag' +); +assert.sameValue( + /\u212a/u.test('K'), + false, + 'Case mapping is not applied in the absence of the `i` flag' +); + +assert( + /\u212a/iu.test('k'), + 'Case mapping is applied in the presence of the `i` and `u` flags' +); +assert( + /\u212a/iu.test('K'), + 'Case mapping is applied in the presence of the `i` and `u` flags' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-class-escape.js b/js/src/tests/test262/language/literals/regexp/u-invalid-class-escape.js new file mode 100644 index 0000000000..fe11f66da5 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-class-escape.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: > + ClassEscape does not recognize "class control" patterns +info: | + ClassEscape[U] :: + b + [+U] - + CharacterClassEscape + CharacterEscape[?U] + + The `u` flag precludes the Annex B extension that enables this pattern. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\c0/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-extended-pattern-char.js b/js/src/tests/test262/language/literals/regexp/u-invalid-extended-pattern-char.js new file mode 100644 index 0000000000..bbcf0e2f3c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-extended-pattern-char.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Quantifiable assertions disallowed with `u` flag +info: | + The `u` flag precludes the use of extended pattern characters irrespective + of the presence of Annex B extensions. + + Term[U] :: + [~U] ExtendedAtom +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/{/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-identity-escape.js b/js/src/tests/test262/language/literals/regexp/u-invalid-identity-escape.js new file mode 100644 index 0000000000..7adfd0245b --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-identity-escape.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Support for UnicodeIDContinue in IdentityEscape +info: | + IdentityEscape[U] :: + [+U] SyntaxCharacter + [+U] / + [~U] SourceCharacter but not UnicodeIDContinue + + The `u` flag precludes the use of characters in UnicodeIDContinue + irrespective of the presence of Annex B extensions. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\M/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-legacy-octal-escape.js b/js/src/tests/test262/language/literals/regexp/u-invalid-legacy-octal-escape.js new file mode 100644 index 0000000000..1d5ea2d650 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-legacy-octal-escape.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-patterns +es6id: 21.2.1 +description: Legacy Octal Escape Sequence not supported with `u` flag +info: | + The `u` flag precludes the use of LegacyOctalEscapeSequence irrespective + of the presence of Annex B extensions. + + CharacterEscape [U] :: + ControlEscape + c ControlLetter + 0[lookahead ∉ DecimalDigit] + HexEscapeSequence + RegExpUnicodeEscapeSequence[?U] + IdentityEscape[?U] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\1/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js new file mode 100644 index 0000000000..43fdc68c86 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-pattern-semantics +es6id: 21.2.2 +description: > + NonEmptyClassRangesNoDash production cannot specify a multi-character set + ("A" parameter) +info: | + The production + NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates + as follows: + + 1. Evaluate ClassAtomNoDash to obtain a CharSet A. + 2. Evaluate ClassAtom to obtain a CharSet B. + 3. Evaluate ClassRanges to obtain a CharSet C. + 4. Call CharacterRange(A, B) and let D be the resulting CharSet. + + 21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation + + 1. If A does not contain exactly one character or B does not contain + exactly one character, throw a SyntaxError exception. + + The `u` flag precludes the Annex B extension that enables this pattern. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/[\d-a]/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js new file mode 100644 index 0000000000..f340b0819c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-pattern-semantics +es6id: 21.2.2 +description: > + NonEmptyClassRangesNoDash production cannot specify a multi-character set + (both "A" and "B" parameters) +info: | + The production + NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates + as follows: + + 1. Evaluate ClassAtomNoDash to obtain a CharSet A. + 2. Evaluate ClassAtom to obtain a CharSet B. + 3. Evaluate ClassRanges to obtain a CharSet C. + 4. Call CharacterRange(A, B) and let D be the resulting CharSet. + + 21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation + + 1. If A does not contain exactly one character or B does not contain + exactly one character, throw a SyntaxError exception. + + The `u` flag precludes the Annex B extension that enables this pattern. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/[\s-\d]/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js new file mode 100644 index 0000000000..1097c84184 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-pattern-semantics +es6id: 21.2.2 +description: > + NonEmptyClassRangesNoDash production cannot specify a multi-character set + ("B" parameter) +info: | + The production + NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates + as follows: + + 1. Evaluate ClassAtomNoDash to obtain a CharSet A. + 2. Evaluate ClassAtom to obtain a CharSet B. + 3. Evaluate ClassRanges to obtain a CharSet C. + 4. Call CharacterRange(A, B) and let D be the resulting CharSet. + + 21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation + + 1. If A does not contain exactly one character or B does not contain + exactly one character, throw a SyntaxError exception. + + The `u` flag precludes the Annex B extension that enables this pattern. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/[%-\d]/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges.js b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges.js new file mode 100644 index 0000000000..a334587895 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-non-empty-class-ranges.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-pattern-semantics +es6id: 21.2.2 +description: > + NonEmptyClassRangesNoDash production cannot specify a multi-character set +info: | + The production + NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates + as follows: + + 1. Evaluate ClassAtomNoDash to obtain a CharSet A. + 2. Evaluate ClassAtom to obtain a CharSet B. + 3. Evaluate ClassRanges to obtain a CharSet C. + 4. Call CharacterRange(A, B) and let D be the resulting CharSet. + + 21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation + + 1. If A does not contain exactly one character or B does not contain + exactly one character, throw a SyntaxError exception. + + The `u` flag precludes the Annex B extension that enables this pattern. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/[--\d]/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-oob-decimal-escape.js b/js/src/tests/test262/language/literals/regexp/u-invalid-oob-decimal-escape.js new file mode 100644 index 0000000000..9e4723169f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-oob-decimal-escape.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-pattern-semantics +es6id: 21.2.2 +description: Out-of-bounds decimal escapes +info: | + 1. Evaluate DecimalEscape to obtain an integer n. + 2. If n>NcapturingParens, throw a SyntaxError exception. + + When the "unicode" flag is set, this algorithm is honored irrespective of + the presence of Annex B extensions. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\8/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookahead.js b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookahead.js new file mode 100644 index 0000000000..7bf80effc7 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookahead.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +es6id: B.1.4 +description: Quantifiable assertions disallowed with `u` flag +info: | + The `u` flag precludes quantifiable assertions (even when Annex B is + honored) + + Term[U] :: + [~U] QuantifiableAssertion Quantifier +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?=.)?/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookbehind.js b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookbehind.js new file mode 100644 index 0000000000..0fa338f56a --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<=.)?/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookahead.js b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookahead.js new file mode 100644 index 0000000000..171ace8dac --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookahead.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +es6id: B.1.4 +description: Quantifiable assertions disallowed with `u` flag +info: | + The `u` flag precludes quantifiable assertions (even when Annex B is + honored) + + Term[U] :: + [~U] QuantifiableAssertion Quantifier +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?!.)?/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookbehind.js b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookbehind.js new file mode 100644 index 0000000000..85945989d3 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-optional-negative-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<!.)?/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookahead.js b/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookahead.js new file mode 100644 index 0000000000..fa1e69e9fb --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookahead.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +es6id: B.1.4 +description: Quantifiable assertions disallowed with `u` flag +info: | + The `u` flag precludes quantifiable assertions (even when Annex B is + honored) + + Term[U] :: + [~U] QuantifiableAssertion Quantifier +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?=.){2,3}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookbehind.js b/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookbehind.js new file mode 100644 index 0000000000..b93fe8065c --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-range-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<=.){2,3}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookahead.js b/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookahead.js new file mode 100644 index 0000000000..3dfbe2dc04 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookahead.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +es6id: B.1.4 +description: Quantifiable assertions disallowed with `u` flag +info: | + The `u` flag precludes quantifiable assertions (even when Annex B is + honored) + + Term[U] :: + [~U] QuantifiableAssertion Quantifier +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?!.){2,3}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookbehind.js b/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookbehind.js new file mode 100644 index 0000000000..ac8519c517 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-invalid-range-negative-lookbehind.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Igalia S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-regular-expressions-patterns +description: Lookbehinds are not treated as a QuantifiableAssertion +info: | + Term[U] :: + [~U] QuantifiableAssertion Quantifier + + QuantifiableAssertion[N]:: + ( ? = Disjunction[~U, ?N] ) + ( ? ! Disjunction[~U, ?N] ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/.(?<!.){2,3}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-null-character-escape.js b/js/src/tests/test262/language/literals/regexp/u-null-character-escape.js new file mode 100644 index 0000000000..4abd046000 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-null-character-escape.js @@ -0,0 +1,27 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-CharacterEscape +description: > + Null character escape is permitted in Unicode patterns. +info: | + CharacterEscape[U] :: + ControlEscape + c ControlLetter + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + RegExpUnicodeEscapeSequence[?U] + IdentityEscape[?U] + + DecimalDigit :: one of + 0 1 2 3 4 5 6 7 8 9 +---*/ + +var nullChar = String.fromCharCode(0); +assert.sameValue(/\0/u.exec(nullChar)[0], nullChar); +assert(/^\0a$/u.test('\0a')); +assert.sameValue('\x00②'.match(/\0②/u)[0], '\x00②'); +assert.sameValue('\u0000፬'.search(/\0፬$/u), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-char-class.js b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-char-class.js new file mode 100644 index 0000000000..b89f509f96 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-char-class.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-atom +es6id: 21.2.2.8 +description: > + Support for surrogate pairs within patterns match by the CharacterClass Atom +info: | + The production Atom :: CharacterClass evaluates as follows: + + 1. Evaluate CharacterClass to obtain a CharSet A and a Boolean invert. + 2. Call CharacterSetMatcher(A, invert) and return its Matcher result. + + Runtime Semantics: CharacterSetMatcher Abstract Operation + + 1. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps when evaluated: + [...] + d. Let cc be Canonicalize(ch). + [...] +---*/ + +assert(/^[\ud800\udc00]$/u.test('\ud800\udc00')); +assert.sameValue( + /[\ud800\udc00]/u.test('\ud800'), + false, + '\\ud800 does not qualify as a class member' +); +assert.sameValue( + /[\ud800\udc00]/u.test('\udc00'), + false, + '\\udc00 does not qualify as a class member' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-dot.js b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-dot.js new file mode 100644 index 0000000000..ae415ce0ee --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-dot.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-atom +es6id: 21.2.2.8 +description: > + Support for surrogate pairs within patterns match by the "period" Atom +info: | + The production Atom :: . evaluates as follows: + + 1. Let A be the set of all characters except LineTerminator. + 2. Call CharacterSetMatcher(A, false) and return its Matcher result. + + Runtime Semantics: CharacterSetMatcher Abstract Operation + + 1. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps when evaluated: + [...] + d. Let cc be Canonicalize(ch). + [...] +---*/ + +assert(/^.$/u.test('\ud800\udc00')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-char-class.js b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-char-class.js new file mode 100644 index 0000000000..a061e90da0 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-char-class.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-atomescape +es6id: 21.2.2.9 +description: > + Support for surrogate pairs within patterns match by the CharacterClassEscape + AtomEscape +info: | + The production AtomEscape :: CharacterClassEscape evaluates as follows: + + 1. Evaluate CharacterClassEscape to obtain a CharSet A. + 2. Call CharacterSetMatcher(A, false) and return its Matcher result. + + Runtime Semantics: CharacterSetMatcher Abstract Operation + + 1. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps when evaluated: + [...] + d. Let cc be Canonicalize(ch). + [...] +---*/ + +assert(/^\S$/u.test('\ud800\udc00')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-decimal.js b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-decimal.js new file mode 100644 index 0000000000..dd45a39d0e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs-atom-escape-decimal.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-atomescape +es6id: 21.2.2.9 +description: > + Support for surrogate pairs within patterns match by the DecimalEscape + AtomEscape +info: | + The production AtomEscape :: DecimalEscape evaluates as follows: + + [...] + 3. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps: + [...] + h. If there exists an integer i between 0 (inclusive) and len (exclusive) + such that Canonicalize(s[i]) is not the same character value as + Canonicalize(Input[e+i]), return failure. + + Runtime Semantics: CharacterSetMatcher Abstract Operation + + 1. Return an internal Matcher closure that takes two arguments, a State x and + a Continuation c, and performs the following steps when evaluated: + [...] + d. Let cc be Canonicalize(ch). + [...] +---*/ + +assert.sameValue(/(.+).*\1/u.test('\ud800\udc00\ud800'), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs.js b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs.js new file mode 100644 index 0000000000..ae24eab16e --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-surrogate-pairs.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Out-of-range value of hexadecimal digits in UnicodeEscapeSequence +es6id: 21.2.2.10 +info: | + 21.2.2.10 CharacterEscape + + The production RegExpUnicodeEscapeSequence :: u LeadSurrogate \u + TrailSurrogate evaluates as follows: + + 1. Let lead be the result of evaluating LeadSurrogate. + 2. Let trail be the result of evaluating TrailSurrogate. + 3. Let cp be UTF16Decode(lead, trail). + 4. Return the character whose character value is cp. +---*/ + +assert(/^[\ud834\udf06]$/u.test('\ud834\udf06')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/u-unicode-esc-bounds.js b/js/src/tests/test262/language/literals/regexp/u-unicode-esc-bounds.js new file mode 100644 index 0000000000..72e5190381 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-unicode-esc-bounds.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Out-of-range value of hexadecimal digits in UnicodeEscapeSequence +es6id: 21.2.1.1 +info: | + 21.2.1.1 Static Semantics: Early Errors + + RegExpUnicodeEscapeSequence :: u{ HexDigits } + + - It is a Syntax Error if the MV of HexDigits > 1114111. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\u{110000}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-unicode-esc-non-hex.js b/js/src/tests/test262/language/literals/regexp/u-unicode-esc-non-hex.js new file mode 100644 index 0000000000..8043548ae5 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-unicode-esc-non-hex.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Non-hexadecimal value within the delimiters of a UnicodeEscapeSequence +es6id: 21.2.1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\u{1,}/u; diff --git a/js/src/tests/test262/language/literals/regexp/u-unicode-esc.js b/js/src/tests/test262/language/literals/regexp/u-unicode-esc.js new file mode 100644 index 0000000000..59844d5639 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-unicode-esc.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Unicode escape interpreted as the Mathematical Value of HexDigits +es6id: 21.2.2.10 +info: | + 21.2.2.10 CharacterEscape + + The production RegExpUnicodeEscapeSequence :: u{ HexDigits } evaluates as + follows: + + 1. Return the character whose code is the MV of HexDigits. +---*/ + +assert(/\u{0}/u.test('\u0000'), 'Minimum value (U+0000)'); +assert(/\u{1}/u.test('\u0001'), 'U+0001'); +assert.sameValue(/\u{1}/u.test('u'), false); +assert(/\u{3f}/u.test('?')); +assert(/\u{000000003f}/u.test('?'), 'Leading zeros'); +assert(/\u{3F}/u.test('?'), 'Case insensitivity'); +assert(/\u{10ffff}/u.test('\udbff\udfff'), 'Maxiumum value (U+10ffff)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/regexp/unicode-escape-nls-err.js b/js/src/tests/test262/language/literals/regexp/unicode-escape-nls-err.js new file mode 100644 index 0000000000..2e218a43c6 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/unicode-escape-nls-err.js @@ -0,0 +1,74 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-Pattern +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence +info: | + Pattern[U, N]:: + Disjunction[?U, ?N] + + Disjunction[U, N]:: + Alternative[?U, ?N] + Alternative[?U, ?N]|Disjunction[?U, ?N] + + Alternative[U, N]:: + [empty] + Alternative[?U, ?N]Term[?U, ?N] + + Term[U, N]:: + Assertion[?U, ?N] + Atom[?U, ?N] + Atom[?U, ?N]Quantifier + + Atom[U, N]:: + PatternCharacter + . + \AtomEscape[?U, ?N] + CharacterClass[?U] + (GroupSpecifier[?U]Disjunction[?U, ?N]) + (?:Disjunction[?U, ?N]) + + AtomEscape[U, N]:: + DecimalEscape + CharacterClassEscape[?U] + CharacterEscape[?U] + [+N]kGroupName[?U] + + CharacterEscape[U]:: + ControlEscape + cControlLetter + 0[lookahead ∉ DecimalDigit] + HexEscapeSequence + RegExpUnicodeEscapeSequence[?U] + IdentityEscape[?U] + + RegExpUnicodeEscapeSequence[U]:: + [+U]uLeadSurrogate\uTrailSurrogate + [+U]uLeadSurrogate + [+U]uTrailSurrogate + [+U]uNonSurrogate + [~U]uHex4Digits + [+U]u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + 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: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/\u{1F_639}/u; diff --git a/js/src/tests/test262/language/literals/regexp/y-assertion-start.js b/js/src/tests/test262/language/literals/regexp/y-assertion-start.js new file mode 100644 index 0000000000..9f7288af9f --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/y-assertion-start.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assertion +es6id: 21.2.2.6 +description: The `y` flag has no effect on the `^` assertion +info: | + Even when the y flag is used with a pattern, ^ always matches only at the + beginning of Input, or (if Multiline is true) at the beginning of a line. +---*/ + +var re; + +re = /^a/y; + +re.lastIndex = 0; +assert.sameValue( + re.test('a'), true, 'positive: beginning of input (without `m`)' +); + +re.lastIndex = 1; +assert.sameValue( + re.test(' a'), false, 'negative: within a line (without `m`)' +); + +re.lastIndex = 1; +assert.sameValue( + re.test('\na'), false, 'negative: beginning of line (without `m`)' +); + +re = /^a/my; + +re.lastIndex = 0; +assert.sameValue( + re.test('a'), true, 'positive: beginning of input (with `m`)' +); + +re.lastIndex = 1; +assert.sameValue( + re.test(' a'), false, 'negative: within a line (with `m`)' +); + +re.lastIndex = 1; +assert.sameValue( + re.test('\na'), true, 'positive: beginning of line (with `m`)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/shell.js b/js/src/tests/test262/language/literals/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/shell.js diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js new file mode 100644 index 0000000000..cf7d8b2b70 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"DoubleStringCharacters_opt\"" +es5id: 7.8.4_A1.1_T1 +description: > + DoubleStringCharacter :: SourceCharacter but not double-quote " or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +""" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js new file mode 100644 index 0000000000..1bacc121ef --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"DoubleStringCharacters_opt\"" +es5id: 7.8.4_A1.1_T2 +description: > + DoubleStringCharacter :: SourceCharacter but not double-quote " or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +" +" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js new file mode 100644 index 0000000000..5b39940322 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: 'SingleStringCharacters_opt'" +es5id: 7.8.4_A1.2_T1 +description: > + SingleStringCharacter :: SourceCharacter but not single-quote ' or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +''' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js new file mode 100644 index 0000000000..408260e9cd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: 'SingleStringCharacters_opt'" +es5id: 7.8.4_A1.2_T2 +description: > + SingleStringCharacter :: SourceCharacter but not single-quote ' or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +' +' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js new file mode 100644 index 0000000000..606999088b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of ENGLISH ALPHABET +es5id: 7.8.4_A2.1_T1 +description: Check ENGLISH CAPITAL ALPHABET +---*/ + +//CHECK#A-Z +var unicode = ["\u0041", "\u0042", "\u0043", "\u0044", "\u0045", "\u0046", "\u0047", "\u0048", "\u0049", "\u004A", "\u004B", "\u004C", "\u004D", "\u004E", "\u004F", "\u0050", "\u0051", "\u0052", "\u0053", "\u0054", "\u0055", "\u0056", "\u0057", "\u0058", "\u0059", "\u005A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js new file mode 100644 index 0000000000..78687d79e0 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of ENGLISH ALPHABET +es5id: 7.8.4_A2.1_T2 +description: Check ENGLISH SMALL ALPHABET +---*/ + +//CHECK#a-z +var hex = ["\u0061", "\u0062", "\u0063", "\u0064", "\u0065", "\u0066", "\u0067", "\u0068", "\u0069", "\u006A", "\u006B", "\u006C", "\u006D", "\u006E", "\u006F", "\u0070", "\u0071", "\u0072", "\u0073", "\u0074", "\u0075", "\u0076", "\u0077", "\u0078", "\u0079", "\u007A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js new file mode 100644 index 0000000000..cc92a4ad3c --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of RUSSIAN ALPHABET +es5id: 7.8.4_A2.2_T1 +description: Check RUSSIAN CAPITAL ALPHABET +---*/ + +//CHECK#А-Я +var unicode = ["\u0410", "\u0411", "\u0412", "\u0413", "\u0414", "\u0415", "\u0416", "\u0417", "\u0418", "\u0419", "\u041A", "\u041B", "\u041C", "\u041D", "\u041E", "\u041F", "\u0420", "\u0421", "\u0422", "\u0423", "\u0424", "\u0425", "\u0426", "\u0427", "\u0428", "\u0429", "\u042A", "\u042B", "\u042C", "\u042D", "\u042E", "\u042F", "\u0401"]; +var character = ["А", "Б", "В", "Г", "Д", "Е", "Ж", "З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ы", "Ь", "Э", "Ю", "Я", "Ё"]; +for (var index = 0; index <= 32; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js new file mode 100644 index 0000000000..5e0e36fa6a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of RUSSIAN ALPHABET +es5id: 7.8.4_A2.2_T2 +description: Check RUSSIAN SMALL ALPHABET +---*/ + +//CHECK#а-я +var unicode = ["\u0430", "\u0431", "\u0432", "\u0433", "\u0434", "\u0435", "\u0436", "\u0437", "\u0438", "\u0439", "\u043A", "\u043B", "\u043C", "\u043D", "\u043E", "\u043F", "\u0440", "\u0441", "\u0442", "\u0443", "\u0444", "\u0445", "\u0446", "\u0447", "\u0448", "\u0449", "\u044A", "\u044B", "\u044C", "\u044D", "\u044E", "\u044F", "\u0451"]; +var character = ["а", "б", "в", "г", "д", "е", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я", "ё"]; +for (var index = 0; index <= 32; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js new file mode 100644 index 0000000000..b2c3b92ee6 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of DIGITS +es5id: 7.8.4_A2.3_T1 +description: Check DIGITS +---*/ + +//CHECK#0-9 +var unicode = ["\u0030", "\u0031", "\u0032", "\u0033", "\u0034", "\u0035", "\u0036", "\u0037", "\u0038", "\u0039"]; +var character = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +for (var index = 0; index <= 9; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js new file mode 100644 index 0000000000..5a579af9f2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\" or '\\' is not correct" +es5id: 7.8.4_A3.1_T1 +description: Checking if execution of "\" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js new file mode 100644 index 0000000000..8db6c37088 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\" or '\\' is not correct" +es5id: 7.8.4_A3.1_T2 +description: Checking if execution of "'\'" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +'\' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js new file mode 100644 index 0000000000..e85ed3e55a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\\\\\" or '\\\\\\' is not correct" +es5id: 7.8.4_A3.2_T1 +description: Checking if execution of "\\\" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\\\" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js new file mode 100644 index 0000000000..a3d4bb194e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\\\\\" or '\\\\\\' is not correct" +es5id: 7.8.4_A3.2_T2 +description: Checking if execution of '\\\' fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +'\\\' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js new file mode 100644 index 0000000000..20f0cbb71d --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: SingleEscapeSequence" +es5id: 7.8.4_A4.1_T1 +description: "SingleEscapeSequence :: one of b f n r t v" +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0008) !== "\b") { + throw new Test262Error('#1: String.fromCharCode(0x0008) === "\\b"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0009) !== "\t") { + throw new Test262Error('#2: String.fromCharCode(0x0009) === "\\t"'); +} + +//CHECK#3 +if (String.fromCharCode(0x000A) !== "\n") { + throw new Test262Error('#3: String.fromCharCode(0x000A) === "\\n"'); +} + +//CHECK#4 +if (String.fromCharCode(0x000B) !== "\v") { + throw new Test262Error('#4: String.fromCharCode(0x000B) === "\\v"'); +} + +//CHECK#5 +if (String.fromCharCode(0x000C) !== "\f") { + throw new Test262Error('#5: String.fromCharCode(0x000C) === "\\f"'); +} + +//CHECK#6 +if (String.fromCharCode(0x000D) !== "\r") { + throw new Test262Error('#6: String.fromCharCode(0x000D) === "\\r"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js new file mode 100644 index 0000000000..ca64058507 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: SingleEscapeSequence" +es5id: 7.8.4_A4.1_T2 +description: "SingleEscapeSequence :: one of ' \" \\" +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0027) !== "\'") { + throw new Test262Error('#1: String.fromCharCode(0x0027) === "\\\'"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0022) !== '\"') { + throw new Test262Error('#2: String.fromCharCode(0x0027) === \'\\\"\''); +} + +//CHECK#3 +if (String.fromCharCode(0x005C) !== "\\") { + throw new Test262Error('#3: String.fromCharCode(0x005C) === "\\\"'); +} + +//CHECK#4 +if ("\'" !== "'") { + throw new Test262Error('#4: "\'" === "\\\'"'); +} + +//CHECK#5 +if ('\"' !== '"') { + throw new Test262Error('#5: \'\"\' === \'\\\"\''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js new file mode 100644 index 0000000000..2abf1e9510 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T1 +description: "NonEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var CharacterCode = [0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A]; +var NonEscapeCharacter = ["\A", "\B", "\C", "\D", "\E", "\F", "\G", "\H", "\I", "\J", "\K", "\L", "\M", "\N", "\O", "\P", "\Q", "\R", "\S", "\T", "\U", "\V", "\W", "\X", "\Y", "\Z"]; +for (var index = 0; index <= 25; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + throw new Test262Error('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js new file mode 100644 index 0000000000..e1680f7815 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js @@ -0,0 +1,115 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T2 +description: "NonEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +if ("A" !== "\A") { + throw new Test262Error('#A'); +} + +if ("B" !== "\B") { + throw new Test262Error('#B'); +} + +if ("C" !== "\C") { + throw new Test262Error('#C'); +} + +if ("D" !== "\D") { + throw new Test262Error('#D'); +} + +if ("E" !== "\E") { + throw new Test262Error('#E'); +} + +if ("F" !== "\F") { + throw new Test262Error('#F'); +} + +if ("G" !== "\G") { + throw new Test262Error('#G'); +} + +if ("H" !== "\H") { + throw new Test262Error('#H'); +} + +if ("I" !== "\I") { + throw new Test262Error('#I'); +} + +if ("J" !== "\J") { + throw new Test262Error('#J'); +} + +if ("K" !== "\K") { + throw new Test262Error('#K'); +} + +if ("L" !== "\L") { + throw new Test262Error('#L'); +} + +if ("M" !== "\M") { + throw new Test262Error('#M'); +} + +if ("N" !== "\N") { + throw new Test262Error('#N'); +} + +if ("O" !== "\O") { + throw new Test262Error('#O'); +} + +if ("P" !== "\P") { + throw new Test262Error('#P'); +} + +if ("Q" !== "\Q") { + throw new Test262Error('#Q'); +} + +if ("R" !== "\R") { + throw new Test262Error('#R'); +} + +if ("S" !== "\S") { + throw new Test262Error('#S'); +} + +if ("T" !== "\T") { + throw new Test262Error('#T'); +} + +if ("U" !== "\U") { + throw new Test262Error('#U'); +} + +if ("V" !== "\V") { + throw new Test262Error('#V'); +} + +if ("W" !== "\W") { + throw new Test262Error('#W'); +} + +if ("X" !== "\X") { + throw new Test262Error('#X'); +} + +if ("Y" !== "\Y") { + throw new Test262Error('#Y'); +} + +if ("Z" !== "\Z") { + throw new Test262Error('#Z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js new file mode 100644 index 0000000000..bd0517559c --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T3 +description: "NonEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z without b, f, n, r, t, v, x, u +var CharacterCode = [0x0061, 0x0063, 0x0064, 0x0065, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006F, 0x0070, 0x0071, 0x0073, 0x0077, 0x0079, 0x007A]; +var NonEscapeCharacter = ["\a", "\c", "\d", "\e", "\g", "\h", "\i", "\j", "\k", "\l", "\m", "\o", "\p", "\q", "\s", "\w", "\y", "\z"]; +for (var index = 0; index <= 17; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + throw new Test262Error('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js new file mode 100644 index 0000000000..6c40a47570 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T4 +description: "NonEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z without b, f, n, r, t, v, x, u + +if ("a" !== "\a") { + throw new Test262Error('#a'); +} + +if ("c" !== "\c") { + throw new Test262Error('#c'); +} + +if ("d" !== "\d") { + throw new Test262Error('#d'); +} + +if ("e" !== "\e") { + throw new Test262Error('#e'); +} + +if ("g" !== "\g") { + throw new Test262Error('#g'); +} + +if ("h" !== "\h") { + throw new Test262Error('#h'); +} + +if ("i" !== "\i") { + throw new Test262Error('#i'); +} + +if ("j" !== "\j") { + throw new Test262Error('#j'); +} + +if ("k" !== "\k") { + throw new Test262Error('#k'); +} + +if ("l" !== "\l") { + throw new Test262Error('#l'); +} + +if ("m" !== "\m") { + throw new Test262Error('#m'); +} + + +if ("o" !== "\o") { + throw new Test262Error('#o'); +} + +if ("p" !== "\p") { + throw new Test262Error('#p'); +} + +if ("q" !== "\q") { + throw new Test262Error('#q'); +} + +if ("s" !== "\s") { + throw new Test262Error('#s'); +} + +if ("w" !== "\w") { + throw new Test262Error('#w'); +} + +if ("y" !== "\y") { + throw new Test262Error('#y'); +} + +if ("z" !== "\z") { + throw new Test262Error('#z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js new file mode 100644 index 0000000000..ec04dceb0e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T5 +description: "NonEscapeSequence :: RUSSIAN CAPITAL ALPHABET" +---*/ + +//CHECK#А-Я +var CharacterCode = [0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0401]; +var NonEscapeCharacter = ["\А", "\Б", "\В", "\Г", "\Д", "\Е", "\Ж", "\З", "\И", "\Й", "\К", "\Л", "\М", "\Н", "\О", "\П", "\Р", "\С", "\Т", "\У", "\Ф", "\Х", "\Ц", "\Ч", "\Ш", "\Щ", "\Ъ", "\Ы", "\Ь", "\Э", "\Ю", "\Я", "\Ё"]; +for (var index = 0; index <= 32; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + throw new Test262Error('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js new file mode 100644 index 0000000000..0d9aef2591 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T6 +description: "NonEscapeSequence :: RUSSIAN CAPITAL ALPHABET" +---*/ + +//CHECK#А-Я + +if ("А" !== "\А") { + throw new Test262Error('#А'); +} + +if ("Б" !== "\Б") { + throw new Test262Error('#Б'); +} + +if ("В" !== "\В") { + throw new Test262Error('#В'); +} + +if ("Г" !== "\Г") { + throw new Test262Error('#Г'); +} + +if ("Д" !== "\Д") { + throw new Test262Error('#Д'); +} + +if ("Е" !== "\Е") { + throw new Test262Error('#Е'); +} + +if ("Ж" !== "\Ж") { + throw new Test262Error('#Ж'); +} + +if ("З" !== "\З") { + throw new Test262Error('#З'); +} + +if ("И" !== "\И") { + throw new Test262Error('#И'); +} + +if ("Й" !== "\Й") { + throw new Test262Error('#Й'); +} + +if ("К" !== "\К") { + throw new Test262Error('#К'); +} + +if ("Л" !== "\Л") { + throw new Test262Error('#Л'); +} + +if ("М" !== "\М") { + throw new Test262Error('#М'); +} + +if ("Н" !== "\Н") { + throw new Test262Error('#Н'); +} + +if ("О" !== "\О") { + throw new Test262Error('#О'); +} + +if ("П" !== "\П") { + throw new Test262Error('#П'); +} + +if ("Р" !== "\Р") { + throw new Test262Error('#Р'); +} + +if ("С" !== "\С") { + throw new Test262Error('#С'); +} + +if ("Т" !== "\Т") { + throw new Test262Error('#Т'); +} + +if ("У" !== "\У") { + throw new Test262Error('#У'); +} + +if ("Ф" !== "\Ф") { + throw new Test262Error('#Ф'); +} + +if ("Х" !== "\Х") { + throw new Test262Error('#Х'); +} + +if ("Ц" !== "\Ц") { + throw new Test262Error('#Ц'); +} + +if ("Ч" !== "\Ч") { + throw new Test262Error('#Ч'); +} + +if ("Ш" !== "\Ш") { + throw new Test262Error('#Ш'); +} + +if ("Щ" !== "\Щ") { + throw new Test262Error('#Щ'); +} + +if ("Ъ" !== "\Ъ") { + throw new Test262Error('#Ъ'); +} + +if ("Ы" !== "\Ы") { + throw new Test262Error('#Ы'); +} + +if ("Ь" !== "\Ь") { + throw new Test262Error('#Ь'); +} + +if ("Э" !== "\Э") { + throw new Test262Error('#Э'); +} + +if ("Ю" !== "\Ю") { + throw new Test262Error('#Ю'); +} + +if ("Я" !== "\Я") { + throw new Test262Error('#Я'); +} + +if ("Ё" !== "\Ё") { + throw new Test262Error('#Ё'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js new file mode 100644 index 0000000000..fa11e5f18a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T7 +description: "NonEscapeSequence :: RUSSIAN SMALL ALPHABET" +---*/ + +//CHECK#а-я +var CharacterCode = [0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x0451]; +var NonEscapeCharacter = ["\а", "\б", "\в", "\г", "\д", "\е", "\ж", "\з", "\и", "\й", "\к", "\л", "\м", "\н", "\о", "\п", "\р", "\с", "\т", "\у", "\ф", "\х", "\ц", "\ч", "\ш", "\щ", "\ъ", "\ы", "\ь", "\э", "\ю", "\я", "\ё"]; +for (var index = 0; index <= 32; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + throw new Test262Error('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js new file mode 100644 index 0000000000..77ae7179e6 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T8 +description: "NonEscapeSequence :: RUSSIAN SMALL ALPHABET" +---*/ + +//CHECK#а-я + +if ("а" !== "\а") { + throw new Test262Error('#а'); +} + +if ("б" !== "\б") { + throw new Test262Error('#б'); +} + +if ("в" !== "\в") { + throw new Test262Error('#в'); +} + +if ("г" !== "\г") { + throw new Test262Error('#г'); +} + +if ("д" !== "\д") { + throw new Test262Error('#д'); +} + +if ("е" !== "\е") { + throw new Test262Error('#е'); +} + +if ("ж" !== "\ж") { + throw new Test262Error('#ж'); +} + +if ("з" !== "\з") { + throw new Test262Error('#з'); +} + +if ("и" !== "\и") { + throw new Test262Error('#и'); +} + +if ("й" !== "\й") { + throw new Test262Error('#й'); +} + +if ("к" !== "\к") { + throw new Test262Error('#к'); +} + +if ("л" !== "\л") { + throw new Test262Error('#л'); +} + +if ("м" !== "\м") { + throw new Test262Error('#м'); +} + +if ("н" !== "\н") { + throw new Test262Error('#н'); +} + +if ("о" !== "\о") { + throw new Test262Error('#о'); +} + +if ("п" !== "\п") { + throw new Test262Error('#п'); +} + +if ("р" !== "\р") { + throw new Test262Error('#р'); +} + +if ("с" !== "\с") { + throw new Test262Error('#с'); +} + +if ("т" !== "\т") { + throw new Test262Error('#т'); +} + +if ("у" !== "\у") { + throw new Test262Error('#у'); +} + +if ("ф" !== "\ф") { + throw new Test262Error('#ф'); +} + +if ("х" !== "\х") { + throw new Test262Error('#х'); +} + +if ("ц" !== "\ц") { + throw new Test262Error('#ц'); +} + +if ("ч" !== "\ч") { + throw new Test262Error('#ч'); +} + +if ("ш" !== "\ш") { + throw new Test262Error('#ш'); +} + +if ("щ" !== "\щ") { + throw new Test262Error('#щ'); +} + +if ("ъ" !== "\ъ") { + throw new Test262Error('#ъ'); +} + +if ("ы" !== "\ы") { + throw new Test262Error('#ы'); +} + +if ("ь" !== "\ь") { + throw new Test262Error('#ь'); +} + +if ("э" !== "\э") { + throw new Test262Error('#э'); +} + +if ("ю" !== "\ю") { + throw new Test262Error('#ю'); +} + +if ("я" !== "\я") { + throw new Test262Error('#я'); +} + +if ("ё" !== "\ё") { + throw new Test262Error('#ё'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js new file mode 100644 index 0000000000..e691313b80 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T1 +description: "EscapeCharacter :: DecimalDigits :: 1" +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +"\1" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js new file mode 100644 index 0000000000..53b059e5bd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T2 +description: "EscapeCharacter :: DecimalDigits :: 7" +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +"\7" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js new file mode 100644 index 0000000000..6f21c6ce1c --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T7 +description: "EscapeCharacter :: SingleEscapeCharacter :: one of b f n r t v" +---*/ + +//CHECK#bfnrtv +if ("b" === "\b") { + throw new Test262Error('#b'); +} + +if ("f" === "\f") { + throw new Test262Error('#f'); +} + +if ("n" === "\n") { + throw new Test262Error('#n'); +} + +if ("r" === "\r") { + throw new Test262Error('#r'); +} + +if ("t" === "\t") { + throw new Test262Error('#t'); +} + +if ("v" === "\v") { + throw new Test262Error('#v'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js new file mode 100644 index 0000000000..99d42c9e38 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T1 +description: String.fromCharCode(0x0000) +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0000) !== "\0") { + throw new Test262Error('#1: String.fromCharCode(0x0000) === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js new file mode 100644 index 0000000000..3a7c1f7c6d --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T2 +description: "\"\\u0000\"" +---*/ + +//CHECK#1 +if ("\u0000" !== "\0") { + throw new Test262Error('#1: "\\u0000" === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js new file mode 100644 index 0000000000..f1d7d0ebf1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T3 +description: "\"\\x00\"" +---*/ + +//CHECK#1 +if ("\x00" !== "\0") { + throw new Test262Error('#1: "\\x00" === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js new file mode 100644 index 0000000000..3c10fc9c32 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T1 +description: "HexEscapeSequence :: HexDigit" +---*/ + +//CHECK#0 +if ("\x00" !== String.fromCharCode("0")) { + throw new Test262Error('#0: "\\x00" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\x01" !== String.fromCharCode("1")) { + throw new Test262Error('#1: "\\x01" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\x02" !== String.fromCharCode("2")) { + throw new Test262Error('#2: "\\x02" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\x03" !== String.fromCharCode("3")) { + throw new Test262Error('#3: "\\x03" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\x04" !== String.fromCharCode("4")) { + throw new Test262Error('#4: "\\x04" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\x05" !== String.fromCharCode("5")) { + throw new Test262Error('#5: "\\x05" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\x06" !== String.fromCharCode("6")) { + throw new Test262Error('#6: "\\x06" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\x07" !== String.fromCharCode("7")) { + throw new Test262Error('#7: "\\x07" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\x08" !== String.fromCharCode("8")) { + throw new Test262Error('#8: "\\x08" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\x09" !== String.fromCharCode("9")) { + throw new Test262Error('#9: "\\x09" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\x0A" !== String.fromCharCode("10")) { + throw new Test262Error('#A: "\\x0A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\x0B" !== String.fromCharCode("11")) { + throw new Test262Error('#B: "\\x0B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\x0C" !== String.fromCharCode("12")) { + throw new Test262Error('#C: "\\x0C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\x0D" !== String.fromCharCode("13")) { + throw new Test262Error('#D: "\\x0D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\x0E" !== String.fromCharCode("14")) { + throw new Test262Error('#E: "\\x0E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\x0F" !== String.fromCharCode("15")) { + throw new Test262Error('#F: "\\x0F" === String.fromCharCode("15")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js new file mode 100644 index 0000000000..7f44b73513 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T2 +description: "HexEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var hex = ["\x41", "\x42", "\x43", "\x44", "\x45", "\x46", "\x47", "\x48", "\x49", "\x4A", "\x4B", "\x4C", "\x4D", "\x4E", "\x4F", "\x50", "\x51", "\x52", "\x53", "\x54", "\x55", "\x56", "\x57", "\x58", "\x59", "\x5A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js new file mode 100644 index 0000000000..4ddbac2dc9 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T3 +description: "HexEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z +var hex = ["\x61", "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x6A", "\x6B", "\x6C", "\x6D", "\x6E", "\x6F", "\x70", "\x71", "\x72", "\x73", "\x74", "\x75", "\x76", "\x77", "\x78", "\x79", "\x7A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js new file mode 100644 index 0000000000..9fda157510 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: \x HexDigit HexDigit SingleStringCharacter +es5id: 7.8.4_A6.3_T1 +description: Check similar to ('\x01F' === String.fromCharCode('1') + 'F') +---*/ + +//CHECK#1 +if ('\x01F' !== String.fromCharCode('1') + 'F') { + throw new Test262Error("#1: '\x01F' === String.fromCharCode('1') + 'F'"); +} + +//CHECK#2 +if ('\x02E' !== String.fromCharCode('2') + 'E') { + throw new Test262Error("#2: '\x02E' === String.fromCharCode('2') + 'E'"); +} + +//CHECK#3 +if ('\x03D' !== String.fromCharCode('3') + 'D') { + throw new Test262Error("#3: '\x03D' === String.fromCharCode('3') + 'D'"); +} + +//CHECK#4 +if ('\x04C' !== String.fromCharCode('4') + 'C') { + throw new Test262Error("#4: '\x04C' === String.fromCharCode('4') + 'C'"); +} + +//CHECK#5 +if ('\x05B' !== String.fromCharCode('5') + 'B') { + throw new Test262Error("#5: '\x05B' === String.fromCharCode('5') + 'B'"); +} + +//CHECK#6 +if ('\x06A' !== String.fromCharCode('6') + 'A') { + throw new Test262Error("#6: '\x06A' === String.fromCharCode('6') + 'A'"); +} + +//CHECK#7 +if ('\x079' !== String.fromCharCode('7') + '9') { + throw new Test262Error("#7: '\x079' === String.fromCharCode('7') + '9'"); +} + +//CHECK#8 +if ('\x088' !== String.fromCharCode('8') + '8') { + throw new Test262Error("#8: '\x088' === String.fromCharCode('8') + '8'"); +} + +//CHECK#9 +if ('\x097' !== String.fromCharCode('9') + '7') { + throw new Test262Error("#9: '\x097' === String.fromCharCode('9') + '7'"); +} + +//CHECK#A +if ('\x0A6' !== String.fromCharCode('10') + '6') { + throw new Test262Error("#A: '\x0A6' === String.fromCharCode('10') + '6'"); +} + +//CHECK#B +if ('\x0B5' !== String.fromCharCode('11') + '5') { + throw new Test262Error("#B: '\x0B5' === String.fromCharCode('11') + '5'"); +} + +//CHECK#C +if ('\x0C4' !== String.fromCharCode('12') + '4') { + throw new Test262Error("#C: '\x0C4' === String.fromCharCode('12') + '4'"); +} + +//CHECK#D +if ('\x0D3' !== String.fromCharCode('13') + '3') { + throw new Test262Error("#D: '\x0D3' === String.fromCharCode('13') + '3'"); +} + +//CHECK#E +if ('\x0E2' !== String.fromCharCode('14') + '2') { + throw new Test262Error("#E: '\x0E2' === String.fromCharCode('14') + '2'"); +} + +//CHECK#F +if ('\x0F1' !== String.fromCharCode('15') + '1') { + throw new Test262Error("#F: '\x0F1' === String.fromCharCode('15') + '1'"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js new file mode 100644 index 0000000000..f37b3437d1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T1 +description: Check similar to ("\u0000" === String.fromCharCode("0")) +---*/ + +//CHECK#0 +if ("\u0000" !== String.fromCharCode("0")) { + throw new Test262Error('#0: "\\u0000" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\u0001" !== String.fromCharCode("1")) { + throw new Test262Error('#1: "\\u0001" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\u0002" !== String.fromCharCode("2")) { + throw new Test262Error('#2: "\\u0002" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\u0003" !== String.fromCharCode("3")) { + throw new Test262Error('#3: "\\u0003" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\u0004" !== String.fromCharCode("4")) { + throw new Test262Error('#4: "\\u0004" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\u0005" !== String.fromCharCode("5")) { + throw new Test262Error('#5: "\\u0005" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\u0006" !== String.fromCharCode("6")) { + throw new Test262Error('#6: "\\u0006" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\u0007" !== String.fromCharCode("7")) { + throw new Test262Error('#7: "\\u0007" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\u0008" !== String.fromCharCode("8")) { + throw new Test262Error('#8: "\\u0008" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\u0009" !== String.fromCharCode("9")) { + throw new Test262Error('#9: "\\u0009" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\u000A" !== String.fromCharCode("10")) { + throw new Test262Error('#A: "\\u000A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\u000B" !== String.fromCharCode("11")) { + throw new Test262Error('#B: "\\u000B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\u000C" !== String.fromCharCode("12")) { + throw new Test262Error('#C: "\\u000C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\u000D" !== String.fromCharCode("13")) { + throw new Test262Error('#D: "\\u000D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\u000E" !== String.fromCharCode("14")) { + throw new Test262Error('#E: "\\u000E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\u000F" !== String.fromCharCode("15")) { + throw new Test262Error('#F: "\\u000F" === String.fromCharCode("15")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js new file mode 100644 index 0000000000..4bae42c896 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T2 +description: "UnicodeEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var unicode = ["\u0041", "\u0042", "\u0043", "\u0044", "\u0045", "\u0046", "\u0047", "\u0048", "\u0049", "\u004A", "\u004B", "\u004C", "\u004D", "\u004E", "\u004F", "\u0050", "\u0051", "\u0052", "\u0053", "\u0054", "\u0055", "\u0056", "\u0057", "\u0058", "\u0059", "\u005A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js new file mode 100644 index 0000000000..ea5181adb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T3 +description: "UnicodeEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z +var unicode = ["\u0061", "\u0062", "\u0063", "\u0064", "\u0065", "\u0066", "\u0067", "\u0068", "\u0069", "\u006A", "\u006B", "\u006C", "\u006D", "\u006E", "\u006F", "\u0070", "\u0071", "\u0072", "\u0073", "\u0074", "\u0075", "\u0076", "\u0077", "\u0078", "\u0079", "\u007A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + throw new Test262Error('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js new file mode 100644 index 0000000000..bd1b245899 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T4 +description: "UnicodeEscapeSequence :: u000G is incorrect" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK# +"\u000G" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js new file mode 100644 index 0000000000..7bcbb19995 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T1 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u1" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js new file mode 100644 index 0000000000..f3be7fe4b2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T2 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js new file mode 100644 index 0000000000..56653c6b5b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T3 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u11" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js new file mode 100644 index 0000000000..56706fb2b4 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T4 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uAA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js new file mode 100644 index 0000000000..4844492a87 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T5 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u111" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js new file mode 100644 index 0000000000..b948f46099 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T6 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uAAA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js new file mode 100644 index 0000000000..8c8b43911d --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: \u HexDigit HexDigit HexDigit HexDigit DoubleStringCharacter +es5id: 7.8.4_A7.3_T1 +description: Check similar to ("\u0001F" === String.fromCharCode("1") + "F") +---*/ + +//CHECK#1 +if ("\u0001F" !== String.fromCharCode("1") + "F") { + throw new Test262Error('#1: "\\u0001F" === String.fromCharCode("1") + "F"'); +} + +//CHECK#2 +if ("\u0002E" !== String.fromCharCode("2") + "E") { + throw new Test262Error('#2: "\\u0002E" === String.fromCharCode("2") + "E"'); +} + +//CHECK#3 +if ("\u0003D" !== String.fromCharCode("3") + "D") { + throw new Test262Error('#3: "\\u0003D" === String.fromCharCode("3") + "D"'); +} + +//CHECK#4 +if ("\u0004C" !== String.fromCharCode("4") + "C") { + throw new Test262Error('#4: "\\u0004C" === String.fromCharCode("4") + "C"'); +} + +//CHECK#5 +if ("\u0005B" !== String.fromCharCode("5") + "B") { + throw new Test262Error('#5: "\\u0005B" === String.fromCharCode("5") + "B"'); +} + +//CHECK#6 +if ("\u0006A" !== String.fromCharCode("6") + "A") { + throw new Test262Error('#6: "\\u0006A" === String.fromCharCode("6") + "A"'); +} + +//CHECK#7 +if ("\u00079" !== String.fromCharCode("7") + "9") { + throw new Test262Error('#7: "\\u00079" === String.fromCharCode("7") + "9"'); +} + +//CHECK#8 +if ("\u00088" !== String.fromCharCode("8") + "8") { + throw new Test262Error('#8: "\\u00088" === String.fromCharCode("8") + "8"'); +} + +//CHECK#9 +if ("\u00097" !== String.fromCharCode("9") + "7") { + throw new Test262Error('#9: "\\u00097" === String.fromCharCode("9") + "7"'); +} + +//CHECK#A +if ("\u000A6" !== String.fromCharCode("10") + "6") { + throw new Test262Error('#A: "\\u000A6" === String.fromCharCode("10") + "6"'); +} + +//CHECK#B +if ("\u000B5" !== String.fromCharCode("11") + "5") { + throw new Test262Error('#B: "\\u000B5" === String.fromCharCode("11") + "5"'); +} + +//CHECK#C +if ("\u000C4" !== String.fromCharCode("12") + "4") { + throw new Test262Error('#C: "\\u000C4" === String.fromCharCode("12") + "4"'); +} + +//CHECK#D +if ("\u000D3" !== String.fromCharCode("13") + "3") { + throw new Test262Error('#D: "\\u000D3" === String.fromCharCode("13") + "3"'); +} + +//CHECK#E +if ("\u000E2" !== String.fromCharCode("14") + "2") { + throw new Test262Error('#E: "\\u000E2" === String.fromCharCode("14") + "2"'); +} + +//CHECK#F +if ("\u000F1" !== String.fromCharCode("15") + "1") { + throw new Test262Error('#F: "\\u000F1" === String.fromCharCode("15") + "1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/browser.js b/js/src/tests/test262/language/literals/string/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/browser.js diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js new file mode 100644 index 0000000000..b1d75b3a2e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 1 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\1"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js new file mode 100644 index 0000000000..4381495669 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 2 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\2"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js new file mode 100644 index 0000000000..93b2d1306e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 3 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\3"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js new file mode 100644 index 0000000000..a53534a08a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 4 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\4"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js new file mode 100644 index 0000000000..a5bed9e50b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 5 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\5"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js new file mode 100644 index 0000000000..be50392eb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 6 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\6"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js new file mode 100644 index 0000000000..f592280dc8 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 7 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\7"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-non-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-non-strict.js new file mode 100644 index 0000000000..666f2f74fe --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-non-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: LegacyOctalEscapeSequence is not available in non-strict code - 8 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 +flags: [noStrict] +---*/ + +assert.sameValue('\8', '8'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js new file mode 100644 index 0000000000..e85972d7bc --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 8 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + NonOctalDecimalEscapeSequence::one of + 8 9 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\8"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js new file mode 100644 index 0000000000..9a5908a896 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: LegacyOctalEscapeSequence is not enabled in strict mode code - 8 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 + + ## 12.8.4.1 Static Semantics: Early Errors + + EscapeSequence :: NonOctalDecimalEscapeSequence + + - It is a Syntax Error if the source code matching this production is strict + mode code. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\8'; diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-non-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-non-strict.js new file mode 100644 index 0000000000..01b6d07f92 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-non-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: LegacyOctalEscapeSequence is not available in non-strict code - 9 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 +flags: [noStrict] +---*/ + +assert.sameValue('\9', '9'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js new file mode 100644 index 0000000000..6e8143c2ec --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 9 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + NonOctalDecimalEscapeSequence::one of + 8 9 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\9"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js new file mode 100644 index 0000000000..dcdf0ad83e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: LegacyOctalEscapeSequence is not enabled in strict mode code - 9 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 + + ## 12.8.4.1 Static Semantics: Early Errors + + EscapeSequence :: NonOctalDecimalEscapeSequence + + - It is a Syntax Error if the source code matching this production is strict + mode code. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\9'; diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js new file mode 100644 index 0000000000..454d99c4f1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2017 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: LegacyOctalEscapeSequence is not available in template literals +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\08'; diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js new file mode 100644 index 0000000000..5c769817e7 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.4-1-s +description: > + A directive preceding an 'use strict' directive may not contain + an OctalEscapeSequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(function() { + "asterisk: \052"; + "use strict"; +}); diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js new file mode 100644 index 0000000000..842ad7bc21 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: LegacyOctalEscapeSequence is not available in template literals +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\1'; diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js new file mode 100644 index 0000000000..4ec55368b3 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js @@ -0,0 +1,154 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: String value for LegacyOctalEscapeSequence +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + LegacyOctalEscapeSequence :: + OctalDigit [lookahead ∉ OctalDigit] + ZeroToThree OctalDigit [lookahead ∉ OctalDigit] + FourToSeven OctalDigit + ZeroToThree OctalDigit OctalDigit + + ZeroToThree :: one of + 0 1 2 3 + + FourToSeven :: one of + 4 5 6 7 +flags: [noStrict] +---*/ + +// LegacyOctalEscapeSequence :: +// OctalDigit [lookahead ∉ OctalDigit] +assert.sameValue('\0', '\x00', '\\0'); +assert.sameValue('\1', '\x01', '\\1'); +assert.sameValue('\2', '\x02', '\\2'); +assert.sameValue('\3', '\x03', '\\3'); +assert.sameValue('\4', '\x04', '\\4'); +assert.sameValue('\5', '\x05', '\\5'); +assert.sameValue('\6', '\x06', '\\6'); +assert.sameValue('\7', '\x07', '\\7'); + +assert.sameValue('\08', '\x008', '\\08'); +assert.sameValue('\18', '\x018', '\\18'); +assert.sameValue('\28', '\x028', '\\28'); +assert.sameValue('\38', '\x038', '\\38'); +assert.sameValue('\48', '\x048', '\\48'); +assert.sameValue('\58', '\x058', '\\58'); +assert.sameValue('\68', '\x068', '\\68'); +assert.sameValue('\78', '\x078', '\\78'); +assert.sameValue('\08', '\x008', '\\08'); + +// LegacyOctalEscapeSequence :: +// ZeroToThree OctalDigit [lookahead ∉ OctalDigit] +assert.sameValue('\00', '\x00', '\\00'); +assert.sameValue('\01', '\x01', '\\01'); +assert.sameValue('\06', '\x06', '\\06'); +assert.sameValue('\07', '\x07', '\\07'); +assert.sameValue('\10', '\x08', '\\10'); +assert.sameValue('\11', '\x09', '\\11'); +assert.sameValue('\16', '\x0e', '\\16'); +assert.sameValue('\17', '\x0f', '\\17'); +assert.sameValue('\20', '\x10', '\\20'); +assert.sameValue('\21', '\x11', '\\21'); +assert.sameValue('\26', '\x16', '\\26'); +assert.sameValue('\27', '\x17', '\\27'); +assert.sameValue('\30', '\x18', '\\30'); +assert.sameValue('\31', '\x19', '\\31'); +assert.sameValue('\36', '\x1e', '\\36'); +assert.sameValue('\37', '\x1f', '\\37'); +assert.sameValue('\008', '\x008', '\\008'); +assert.sameValue('\018', '\x018', '\\018'); +assert.sameValue('\068', '\x068', '\\068'); +assert.sameValue('\078', '\x078', '\\078'); +assert.sameValue('\108', '\x088', '\\108'); +assert.sameValue('\118', '\x098', '\\118'); +assert.sameValue('\168', '\x0e8', '\\168'); +assert.sameValue('\178', '\x0f8', '\\178'); +assert.sameValue('\208', '\x108', '\\208'); +assert.sameValue('\218', '\x118', '\\218'); +assert.sameValue('\268', '\x168', '\\268'); +assert.sameValue('\278', '\x178', '\\278'); +assert.sameValue('\308', '\x188', '\\308'); +assert.sameValue('\318', '\x198', '\\318'); +assert.sameValue('\368', '\x1e8', '\\368'); +assert.sameValue('\378', '\x1f8', '\\378'); + +// LegacyOctalEscapeSequence :: +// FourToSeven OctalDigit +assert.sameValue('\40', '\x20', '\\40'); +assert.sameValue('\41', '\x21', '\\41'); +assert.sameValue('\46', '\x26', '\\46'); +assert.sameValue('\47', '\x27', '\\47'); +assert.sameValue('\50', '\x28', '\\50'); +assert.sameValue('\51', '\x29', '\\51'); +assert.sameValue('\56', '\x2e', '\\56'); +assert.sameValue('\57', '\x2f', '\\57'); +assert.sameValue('\60', '\x30', '\\60'); +assert.sameValue('\61', '\x31', '\\61'); +assert.sameValue('\66', '\x36', '\\66'); +assert.sameValue('\67', '\x37', '\\67'); +assert.sameValue('\70', '\x38', '\\70'); +assert.sameValue('\71', '\x39', '\\71'); +assert.sameValue('\76', '\x3e', '\\76'); +assert.sameValue('\77', '\x3f', '\\77'); +assert.sameValue('\400', '\x200', '\\400'); +assert.sameValue('\410', '\x210', '\\410'); +assert.sameValue('\460', '\x260', '\\460'); +assert.sameValue('\470', '\x270', '\\470'); +assert.sameValue('\500', '\x280', '\\500'); +assert.sameValue('\510', '\x290', '\\510'); +assert.sameValue('\560', '\x2e0', '\\560'); +assert.sameValue('\570', '\x2f0', '\\570'); +assert.sameValue('\600', '\x300', '\\600'); +assert.sameValue('\610', '\x310', '\\610'); +assert.sameValue('\660', '\x360', '\\660'); +assert.sameValue('\670', '\x370', '\\670'); +assert.sameValue('\700', '\x380', '\\700'); +assert.sameValue('\710', '\x390', '\\710'); +assert.sameValue('\760', '\x3e0', '\\760'); +assert.sameValue('\770', '\x3f0', '\\770'); + +// LegacyOctalEscapeSequence :: +// ZeroToThree OctalDigit OctalDigit +assert.sameValue('\000', '\x00', '\\000'); +assert.sameValue('\001', '\x01', '\\001'); +assert.sameValue('\010', '\x08', '\\010'); +assert.sameValue('\006', '\x06', '\\006'); +assert.sameValue('\060', '\x30', '\\060'); +assert.sameValue('\007', '\x07', '\\007'); +assert.sameValue('\070', '\x38', '\\070'); +assert.sameValue('\077', '\x3f', '\\077'); +assert.sameValue('\100', '\x40', '\\100'); +assert.sameValue('\101', '\x41', '\\101'); +assert.sameValue('\110', '\x48', '\\110'); +assert.sameValue('\106', '\x46', '\\106'); +assert.sameValue('\160', '\x70', '\\160'); +assert.sameValue('\107', '\x47', '\\107'); +assert.sameValue('\170', '\x78', '\\170'); +assert.sameValue('\177', '\x7f', '\\177'); +assert.sameValue('\200', '\x80', '\\200'); +assert.sameValue('\201', '\x81', '\\201'); +assert.sameValue('\210', '\x88', '\\210'); +assert.sameValue('\206', '\x86', '\\206'); +assert.sameValue('\260', '\xb0', '\\260'); +assert.sameValue('\207', '\x87', '\\207'); +assert.sameValue('\270', '\xb8', '\\270'); +assert.sameValue('\277', '\xbf', '\\277'); +assert.sameValue('\300', '\xc0', '\\300'); +assert.sameValue('\301', '\xc1', '\\301'); +assert.sameValue('\310', '\xc8', '\\310'); +assert.sameValue('\306', '\xc6', '\\306'); +assert.sameValue('\360', '\xf0', '\\360'); +assert.sameValue('\307', '\xc7', '\\307'); +assert.sameValue('\370', '\xf8', '\\370'); +assert.sameValue('\377', '\xff', '\\377'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-continuation-double.js b/js/src/tests/test262/language/literals/string/line-continuation-double.js new file mode 100644 index 0000000000..1ab165a4dd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-continuation-double.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + Line terminators may occur within string literals as part of a |LineContinuation| + to produce the empty code points sequence. +info: | + 11.8.4 String Literals + + StringLiteral :: + `"` DoubleStringCharacters? `"` + `'` SingleStringCharacters? `'` + + DoubleStringCharacters :: + DoubleStringCharacter DoubleStringCharacters? + + DoubleStringCharacter :: + SourceCharacter but not one of `"` or `\` or LineTerminator + <LS> + <PS> + `\` EscapeSequence + LineContinuation + + LineContinuation :: + `\` LineTerminatorSequence + + 11.3 Line Terminators + + LineTerminatorSequence :: + <LF> + <CR> [lookahead != <LF>] + <LS> + <PS> + <CR> <LF> + + 11.8.4.2 Static Semantics: SV + + The SV of DoubleStringCharacter :: LineContinuation is the empty code unit sequence. +---*/ + +// LineTerminatorSequence :: <LF> +assert.sameValue("\ +", ""); + +// LineTerminatorSequence :: <CR> [lookahead ≠ <LF>] +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <LS> +// <LS> is U+2028 LINE SEPARATOR; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <PS> +// <PS> is U+2029 PARAGRAPH SEPARATOR; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <CR> <LF> +assert.sameValue("\
+", ""); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-continuation-single.js b/js/src/tests/test262/language/literals/string/line-continuation-single.js new file mode 100644 index 0000000000..6c0a5184bf --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-continuation-single.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + Line terminators may occur within string literals as part of a |LineContinuation| + to produce the empty code points sequence. +info: | + 11.8.4 String Literals + + StringLiteral :: + `"` DoubleStringCharacters? `"` + `'` SingleStringCharacters? `'` + + SingleStringCharacters :: + SingleStringCharacter SingleStringCharacters? + + SingleStringCharacter :: + SourceCharacter but not one of `'` or `\` or LineTerminator + <LS> + <PS> + `\` EscapeSequence + LineContinuation + + LineContinuation :: + `\` LineTerminatorSequence + + 11.3 Line Terminators + + LineTerminatorSequence :: + <LF> + <CR> [lookahead != <LF>] + <LS> + <PS> + <CR> <LF> + + 11.8.4.2 Static Semantics: SV + + The SV of SingleStringCharacter :: LineContinuation is the empty code unit sequence. +---*/ + +// LineTerminatorSequence :: <LF> +assert.sameValue('\ +', ''); + +// LineTerminatorSequence :: <CR> [lookahead ≠ <LF>] +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <LS> +// <LS> is U+2028 LINE SEPARATOR; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <PS> +// <PS> is U+2029 PARAGRAPH SEPARATOR; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <CR> <LF> +assert.sameValue('\
+', ''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-separator-eval.js b/js/src/tests/test262/language/literals/string/line-separator-eval.js new file mode 100644 index 0000000000..4eb677af99 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-separator-eval.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2028 LINE SEPARATOR can appear in string literals (eval code). +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +assert.sameValue(eval("'\u2028'"), "\u2028"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-separator.js b/js/src/tests/test262/language/literals/string/line-separator.js new file mode 100644 index 0000000000..86e9c507d7 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-separator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2028 LINE SEPARATOR can appear in string literals. +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +// U+2028 in strings; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue("
", "\u2028"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js new file mode 100644 index 0000000000..18dfeb32d8 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in string literals (eval code). +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +assert.sameValue(eval("'\u180E'"), "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js new file mode 100644 index 0000000000..7e4a99c815 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in string literals. +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +// U+180E in strings; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue("", "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js b/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js new file mode 100644 index 0000000000..88d7ae6ae9 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2029 PARAGRAPH SEPARATOR can appear in string literals (eval code). +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +assert.sameValue(eval("'\u2029'"), "\u2029"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/paragraph-separator.js b/js/src/tests/test262/language/literals/string/paragraph-separator.js new file mode 100644 index 0000000000..339e97f89f --- /dev/null +++ b/js/src/tests/test262/language/literals/string/paragraph-separator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2029 PARAGRAPH SEPARATOR can appear in string literals. +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +// U+2029 in strings; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue("
", "\u2029"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/shell.js b/js/src/tests/test262/language/literals/string/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/shell.js diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js new file mode 100644 index 0000000000..11843f2c9b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence (DoubleStringCharacters) +info: | + StringLiteral:: + "DoubleStringCharacters opt" + 'SingleStringCharacters opt' + + DoubleStringCharacters:: + DoubleStringCharacter DoubleStringCharacters opt + + DoubleStringCharacter:: + SourceCharacter but not one of " or \ or LineTerminator + \ EscapeSequence + LineContinuation + + EscapeSequence:: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + uHex4Digits + u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + 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: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +"\u{1F_639}" diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js new file mode 100644 index 0000000000..3052d893ab --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence (DoubleStringCharacters) +info: | + StringLiteral:: + "DoubleStringCharacters opt" + 'SingleStringCharacters opt' + + SingleStringCharacters:: + SingleStringCharacterSingleStringCharactersopt + + SingleStringCharacter:: + SourceCharacterbut not one of ' or \ or LineTerminator + \ EscapeSequence + LineContinuation + + EscapeSequence:: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + uHex4Digits + u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + 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: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\u{1F_639}'; diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js new file mode 100644 index 0000000000..afa71f94b1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: > + \u is at the end of string, Hex4Digits is required. +info: | + StringLiteral :: + " DoubleStringCharacters_opt " + ' SingleStringCharacters_opt ' + + DoubleStringCharacters :: + DoubleStringCharacter DoubleStringCharacters_opt + + DoubleStringCharacter :: + SourceCharacter but not one of " or \ or LineTerminator + <LS> + <PS> + \ EscapeSequence + LineContinuation + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + u Hex4Digits + u{ CodePoint } + + Hex4Digits :: + HexDigit HexDigit HexDigit 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 +---*/ + +$DONOTEVALUATE(); + +"\u" diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js new file mode 100644 index 0000000000..b6cadf80a1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: > + \u is at the end of string, Hex4Digits is required. +info: | + StringLiteral :: + " DoubleStringCharacters_opt " + ' SingleStringCharacters_opt ' + + SingleStringCharacters :: + SingleStringCharacter SingleStringCharacters_opt + + SingleStringCharacter :: + SourceCharacter but not one of ' or \ or LineTerminator + <LS> + <PS> + \ EscapeSequence + LineContinuation + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + u Hex4Digits + u{ CodePoint } + + Hex4Digits :: + HexDigit HexDigit HexDigit 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 +---*/ + +$DONOTEVALUATE(); + +'\u' |