summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/language/literals
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/language/literals')
-rw-r--r--js/src/tests/test262/annexB/language/literals/browser.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/numeric/browser.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/numeric/legacy-octal-integer.js51
-rw-r--r--js/src/tests/test262/annexB/language/literals/numeric/non-octal-decimal-integer.js121
-rw-r--r--js/src/tests/test262/annexB/language/literals/numeric/shell.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/browser.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/class-escape.js72
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/extended-pattern-char.js32
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js48
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/legacy-octal-escape.js72
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges-no-dash.js49
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges.js36
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-followed-by.js70
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-not-followed-by.js70
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/shell.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/shell.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/string/browser.js0
-rw-r--r--js/src/tests/test262/annexB/language/literals/string/legacy-octal-escape-sequence.js154
-rw-r--r--js/src/tests/test262/annexB/language/literals/string/shell.js0
19 files changed, 775 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/literals/browser.js b/js/src/tests/test262/annexB/language/literals/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/browser.js
diff --git a/js/src/tests/test262/annexB/language/literals/numeric/browser.js b/js/src/tests/test262/annexB/language/literals/numeric/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/numeric/browser.js
diff --git a/js/src/tests/test262/annexB/language/literals/numeric/legacy-octal-integer.js b/js/src/tests/test262/annexB/language/literals/numeric/legacy-octal-integer.js
new file mode 100644
index 0000000000..d77bd4ddb9
--- /dev/null
+++ b/js/src/tests/test262/annexB/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-additional-syntax-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/annexB/language/literals/numeric/non-octal-decimal-integer.js b/js/src/tests/test262/annexB/language/literals/numeric/non-octal-decimal-integer.js
new file mode 100644
index 0000000000..68d60b87ab
--- /dev/null
+++ b/js/src/tests/test262/annexB/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-additional-syntax-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/annexB/language/literals/numeric/shell.js b/js/src/tests/test262/annexB/language/literals/numeric/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/numeric/shell.js
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/browser.js b/js/src/tests/test262/annexB/language/literals/regexp/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/browser.js
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/class-escape.js b/js/src/tests/test262/annexB/language/literals/regexp/class-escape.js
new file mode 100644
index 0000000000..dc83ac701e
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/class-escape.js
@@ -0,0 +1,72 @@
+// 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: Extensions to ClassEscape
+info: |
+ ClassEscape[U] ::
+ b
+ [+U] -
+ [~U] c ClassControlLetter
+ CharacterClassEscape
+ CharacterEscape[?U]
+
+ ClassControlLetter ::
+ DecimalDigit
+ _
+
+ The production ClassEscape :: c ClassControlLetter evaluates as follows:
+
+ 1. Let ch be the character matched by ClassControlLetter.
+ 2. Let i be ch's character value.
+ 3. Let j be the remainder of dividing i by 32.
+ 4. Let d be the character whose character value is j.
+ 5. Return the CharSet containing the single character d.
+---*/
+
+var match;
+
+match = /\c0/.exec('\x0f\x10\x11');
+assert.sameValue(match, null, '\\c0 outside of CharacterClass');
+
+match = /[\c0]/.exec('\x0f\x10\x11');
+assert.sameValue(match[0], '\x10', '\\c0 within CharacterClass');
+
+match = /[\c00]+/.exec('\x0f0\x10\x11');
+assert.sameValue(match[0], '0\x10', '\\c00 within CharacterClass');
+
+match = /\c1/.exec('\x10\x11\x12');
+assert.sameValue(match, null, '\\c1 outside of CharacterClass');
+
+match = /[\c1]/.exec('\x10\x11\x12');
+assert.sameValue(match[0], '\x11', '\\c1 within CharacterClass');
+
+match = /[\c10]+/.exec('\x100\x11\x12');
+assert.sameValue(match[0], '0\x11', '\\c10 within CharacterClass');
+
+match = /\c8/.exec('\x17\x18\x19');
+assert.sameValue(match, null, '\\c8 outside of CharacterClass');
+
+match = /[\c8]/.exec('\x17\x18\x19');
+assert.sameValue(match[0], '\x18', '\\c8 within CharacterClass');
+
+match = /[\c80]+/.exec('\x170\x18\x19');
+assert.sameValue(match[0], '0\x18', '\\c80 within CharacterClass');
+
+match = /\c9/.exec('\x18\x19\x1a');
+assert.sameValue(match, null, '\\c9 outside of CharacterClass');
+
+match = /[\c9]/.exec('\x18\x19\x1a');
+assert.sameValue(match[0], '\x19', '\\c9 within CharacterClass');
+
+match = /[\c90]+/.exec('\x180\x19\x1a');
+assert.sameValue(match[0], '0\x19', '\\c90 within CharacterClass');
+
+match = /\c_/.exec('\x1e\x1f\x20');
+assert.sameValue(match, null, '\\c_ outside of CharacterClass');
+
+match = /[\c_]/.exec('\x1e\x1f\x20');
+assert.sameValue(match[0], '\x1f', '\\c_ within CharacterClass');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/extended-pattern-char.js b/js/src/tests/test262/annexB/language/literals/regexp/extended-pattern-char.js
new file mode 100644
index 0000000000..0624df6850
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/extended-pattern-char.js
@@ -0,0 +1,32 @@
+// 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: Extended Pattern Characters (as distinct from Pattern Characters)
+info: |
+ ExtendedPatternCharacter ::
+ SourceCharacterbut not one of ^$.*+?()[|
+
+ The production ExtendedAtom::ExtendedPatternCharacter evaluates as follows:
+
+ 1. Let ch be the character represented by ExtendedPatternCharacter.
+ 2. Let A be a one-element CharSet containing the character ch.
+ 3. Call CharacterSetMatcher(A, false) and return its Matcher result.
+---*/
+
+var match;
+
+match = /]/.exec(' ]{}');
+assert.sameValue(match[0], ']');
+
+match = /{/.exec(' ]{}');
+assert.sameValue(match[0], '{');
+
+match = /}/.exec(' ]{}');
+assert.sameValue(match[0], '}');
+
+match = /x{o}x/.exec('x{o}x');
+assert.sameValue(match[0], 'x{o}x');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js b/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js
new file mode 100644
index 0000000000..b1c3a53bee
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.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-regular-expressions-patterns
+es6id: B.1.4
+description: Support for UnicodeIDContinue in IdentityEscape
+info: |
+ IdentityEscape[U] ::
+ [+U] SyntaxCharacter
+ [+U] /
+ [~U] SourceCharacter but not c
+---*/
+
+var match;
+
+match = /\C/.exec('ABCDE');
+assert.sameValue(match[0], 'C');
+
+match = /O\PQ/.exec('MNOPQRS');
+assert.sameValue(match[0], 'OPQ');
+
+match = /\8/.exec('789');
+assert.sameValue(match[0], '8');
+
+match = /7\89/.exec('67890');
+assert.sameValue(match[0], '789');
+
+match = /\9/.exec('890');
+assert.sameValue(match[0], '9');
+
+match = /8\90/.exec('78900');
+assert.sameValue(match[0], '890');
+
+match = /(.)(.)(.)(.)(.)(.)(.)(.)\8\8/.exec('0123456777');
+assert.sameValue(
+ match[0],
+ '0123456777',
+ 'DecimalEscape takes precedence over IdentityEscape (\\8)'
+);
+
+match = /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\9/.exec('01234567888');
+assert.sameValue(
+ match[0],
+ '01234567888',
+ 'DecimalEscape takes precedence over IdentityEscape (\\9)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/legacy-octal-escape.js b/js/src/tests/test262/annexB/language/literals/regexp/legacy-octal-escape.js
new file mode 100644
index 0000000000..935ca31391
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/legacy-octal-escape.js
@@ -0,0 +1,72 @@
+// 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
+description: Legacy Octal Escape Sequence
+info: |
+ CharacterEscape[U] ::
+ ControlEscape
+ c ControlLetter
+ 0 [lookahead ∉ DecimalDigit]
+ HexEscapeSequence
+ RegExpUnicodeEscapeSequence[?U]
+ [~U] LegacyOctalEscapeSequence
+ IdentityEscape[?U]
+
+ LegacyOctalEscapeSequence ::
+ OctalDigit [lookahead ∉ OctalDigit]
+ ZeroToThree OctalDigit [lookahead ∉ OctalDigit]
+ FourToSeven OctalDigit
+ ZeroToThree OctalDigit OctalDigit
+
+ The production CharacterEscape :: LegacyOctalEscapeSequence evaluates by
+ evaluating the SV of the LegacyOctalEscapeSequence (see B.1.2) and
+ returning its character result.
+---*/
+
+assert.sameValue(/\1/.exec('\x01')[0], '\x01', '\\1');
+assert.sameValue(/\2/.exec('\x02')[0], '\x02', '\\2');
+assert.sameValue(/\3/.exec('\x03')[0], '\x03', '\\3');
+assert.sameValue(/\4/.exec('\x04')[0], '\x04', '\\4');
+assert.sameValue(/\5/.exec('\x05')[0], '\x05', '\\5');
+assert.sameValue(/\6/.exec('\x06')[0], '\x06', '\\6');
+assert.sameValue(/\7/.exec('\x07')[0], '\x07', '\\7');
+
+assert.sameValue(/\00/.exec('\x00')[0], '\x00', '\\00');
+assert.sameValue(/\07/.exec('\x07')[0], '\x07', '\\07');
+
+assert.sameValue(/\30/.exec('\x18')[0], '\x18', '\\30');
+assert.sameValue(/\37/.exec('\x1f')[0], '\x1f', '\\37');
+
+assert.sameValue(/\40/.exec('\x20')[0], '\x20', '\\40');
+assert.sameValue(/\47/.exec('\x27')[0], '\x27', '\\47');
+
+assert.sameValue(/\70/.exec('\x38')[0], '\x38', '\\70');
+assert.sameValue(/\77/.exec('\x3f')[0], '\x3f', '\\77');
+
+// Sequence is bounded according to the String Value
+assert.sameValue(/\400/.exec('\x200')[0], '\x200', '\\400');
+assert.sameValue(/\470/.exec('\x270')[0], '\x270', '\\470');
+assert.sameValue(/\700/.exec('\x380')[0], '\x380', '\\700');
+assert.sameValue(/\770/.exec('\x3f0')[0], '\x3f0', '\\770');
+
+assert.sameValue(/\000/.exec('\x00')[0], '\x00', '\\000');
+assert.sameValue(/\007/.exec('\x07')[0], '\x07', '\\007');
+assert.sameValue(/\070/.exec('\x38')[0], '\x38', '\\070');
+
+assert.sameValue(/\300/.exec('\xc0')[0], '\xc0', '\\300');
+assert.sameValue(/\307/.exec('\xc7')[0], '\xc7', '\\307');
+assert.sameValue(/\370/.exec('\xf8')[0], '\xf8', '\\370');
+assert.sameValue(/\377/.exec('\xff')[0], '\xff', '\\377');
+
+// Sequence is 3 characters max, including leading zeros
+assert.sameValue(/\0111/.exec('\x091')[0], '\x091', '\\0111');
+assert.sameValue(/\0022/.exec('\x022')[0], '\x022', '\\0022');
+assert.sameValue(/\0003/.exec('\x003')[0], '\x003', '\\0003');
+
+var match = /(.)\1/.exec('a\x01 aa');
+assert.sameValue(
+ match[0], 'aa', 'DecimalEscape takes precedence over LegacyOctalEscapeSequence'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges-no-dash.js b/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges-no-dash.js
new file mode 100644
index 0000000000..2d0984290e
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges-no-dash.js
@@ -0,0 +1,49 @@
+// 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: Extensions to NonemptyClassRangesNoDash production
+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 CharacterRangeOrUnion(A, B) and let D be the resulting CharSet.
+ 5. Return the union of CharSets D and C.
+
+ B.1.4.1.1 Runtime Semantics: CharacterRangeOrUnion Abstract Operation
+
+ 1. If Unicode is false, then
+ a. If A does not contain exactly one character or B does not contain
+ exactly one character, then
+ i. Let C be the CharSet containing the single character - U+002D
+ (HYPHEN-MINUS).
+ ii. Return the union of CharSets A, B and C.
+ 2. Return CharacterRange(A, B).
+---*/
+
+var match;
+
+match = /[\d-a]+/.exec(':a0123456789-:');
+assert.sameValue(match[0], 'a0123456789-');
+
+match = /[\d-az]+/.exec(':a0123456789z-:');
+assert.sameValue(match[0], 'a0123456789z-');
+
+match = /[%-\d]+/.exec('&%0123456789-&');
+assert.sameValue(match[0], '%0123456789-');
+
+match = /[%-\dz]+/.exec('&%0123456789z-&');
+assert.sameValue(match[0], '%0123456789z-');
+
+match = /[\s-\d]+/.exec('& \t0123456789-&');
+assert.sameValue(match[0], ' \t0123456789-');
+
+match = /[\s-\dz]+/.exec('& \t0123456789z-&');
+assert.sameValue(match[0], ' \t0123456789z-');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges.js b/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges.js
new file mode 100644
index 0000000000..7aad0745ee
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/non-empty-class-ranges.js
@@ -0,0 +1,36 @@
+// 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: Extensions to NonemptyClassRanges production
+info: |
+ The production NonemptyClassRanges :: ClassAtom-ClassAtom ClassRanges
+ evaluates as follows:
+
+ 1. Evaluate the first ClassAtom to obtain a CharSet A.
+ 2. Evaluate the second ClassAtom to obtain a CharSet B.
+ 3. Evaluate ClassRanges to obtain a CharSet C.
+ 4. Call CharacterRangeOrUnion(A, B) and let D be the resulting CharSet.
+ 5. Return the union of CharSets D and C.
+
+ B.1.4.1.1 Runtime Semantics: CharacterRangeOrUnion Abstract Operation
+
+ 1. If Unicode is false, then
+ a. If A does not contain exactly one character or B does not contain
+ exactly one character, then
+ i. Let C be the CharSet containing the single character - U+002D
+ (HYPHEN-MINUS).
+ ii. Return the union of CharSets A, B and C.
+ 2. Return CharacterRange(A, B).
+---*/
+
+var match;
+
+match = /[--\d]+/.exec('.-0123456789-.');
+assert.sameValue(match[0], '-0123456789-');
+
+match = /[--\dz]+/.exec('.-0123456789z-.');
+assert.sameValue(match[0], '-0123456789z-');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-followed-by.js b/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-followed-by.js
new file mode 100644
index 0000000000..4e09b24a95
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-followed-by.js
@@ -0,0 +1,70 @@
+// 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 `?=` ("followed by")
+info: |
+ Term[U] ::
+ [~U] QuantifiableAssertion Quantifier
+
+ QuantifiableAssertion ::
+ ( ?= Disjunction )
+ ( ?! Disjunction )
+
+ The production Term::QuantifiableAssertionQuantifier evaluates the same as
+ the production Term::AtomQuantifier but with QuantifiableAssertion
+ substituted for Atom.
+
+ The production Assertion::QuantifiableAssertion evaluates by evaluating
+ QuantifiableAssertion to obtain a Matcher and returning that Matcher.
+
+ Assertion (21.2.2.6) evaluation rules for the Assertion::(?=Disjunction)
+ and Assertion::(?!Disjunction) productions are also used for the
+ QuantifiableAssertion productions, but with QuantifiableAssertion
+ substituted for Assertion.
+---*/
+
+var match;
+
+match = /.(?=Z)*/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'a', 'quantifier: *');
+
+match = /.(?=Z)+/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: +');
+
+match = /.(?=Z)?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'a', 'quantifier: ?');
+
+match = /.(?=Z){2}/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits }');
+
+match = /.(?=Z){2,}/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits , }');
+
+match = /.(?=Z){2,3}/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(
+ match[0], 'b', 'quantifier: { DecimalDigits , DecimalDigits }'
+);
+
+match = /.(?=Z)*?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'a', 'quantifier: * ?');
+
+match = /.(?=Z)+?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: + ?');
+
+match = /.(?=Z)??/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'a', 'quantifier: ? ?');
+
+match = /.(?=Z){2}?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits } ?');
+
+match = /.(?=Z){2,}?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits , } ?');
+
+match = /.(?=Z){2,3}?/.exec('a bZ cZZ dZZZ eZZZZ');
+assert.sameValue(
+ match[0], 'b', 'quantifier: { DecimalDigits , DecimalDigits } ?'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-not-followed-by.js b/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-not-followed-by.js
new file mode 100644
index 0000000000..2b92affa3a
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/quantifiable-assertion-not-followed-by.js
@@ -0,0 +1,70 @@
+// 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 `?!` ("not followed by")
+info: |
+ Term[U] ::
+ [~U] QuantifiableAssertion Quantifier
+
+ QuantifiableAssertion::
+ ( ?= Disjunction )
+ ( ?! Disjunction )
+
+ The production Term::QuantifiableAssertionQuantifier evaluates the same as
+ the production Term::AtomQuantifier but with QuantifiableAssertion
+ substituted for Atom.
+
+ The production Assertion::QuantifiableAssertion evaluates by evaluating
+ QuantifiableAssertion to obtain a Matcher and returning that Matcher.
+
+ Assertion (21.2.2.6) evaluation rules for the Assertion::(?=Disjunction)
+ and Assertion::(?!Disjunction) productions are also used for the
+ QuantifiableAssertion productions, but with QuantifiableAssertion
+ substituted for Assertion.
+---*/
+
+var match;
+
+match = /[a-e](?!Z)*/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'a', 'quantifier: *');
+
+match = /[a-e](?!Z)+/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: +');
+
+match = /[a-e](?!Z)?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'a', 'quantifier: ?');
+
+match = /[a-e](?!Z){2}/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits }');
+
+match = /[a-e](?!Z){2,}/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits , }');
+
+match = /[a-e](?!Z){2,3}/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(
+ match[0], 'e', 'quantifier: { DecimalDigits , DecimalDigits }'
+);
+
+match = /[a-e](?!Z)*?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'a', 'quantifier: * ?');
+
+match = /[a-e](?!Z)+?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: + ?');
+
+match = /[a-e](?!Z)??/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'a', 'quantifier: ? ?');
+
+match = /[a-e](?!Z){2}?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits } ?');
+
+match = /[a-e](?!Z){2,}?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits , } ?');
+
+match = /[a-e](?!Z){2,3}?/.exec('aZZZZ bZZZ cZZ dZ e');
+assert.sameValue(
+ match[0], 'e', 'quantifier: { DecimalDigits , DecimalDigits } ?'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/shell.js b/js/src/tests/test262/annexB/language/literals/regexp/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/shell.js
diff --git a/js/src/tests/test262/annexB/language/literals/shell.js b/js/src/tests/test262/annexB/language/literals/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/shell.js
diff --git a/js/src/tests/test262/annexB/language/literals/string/browser.js b/js/src/tests/test262/annexB/language/literals/string/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/string/browser.js
diff --git a/js/src/tests/test262/annexB/language/literals/string/legacy-octal-escape-sequence.js b/js/src/tests/test262/annexB/language/literals/string/legacy-octal-escape-sequence.js
new file mode 100644
index 0000000000..26e76c7a52
--- /dev/null
+++ b/js/src/tests/test262/annexB/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-additional-syntax-string-literals
+es6id: B.1.2
+description: String value for LegacyOctalEscapeSequence
+info: |
+ EscapeSequence ::
+ CharacterEscapeSequence
+ LegacyOctalEscapeSequence
+ 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/annexB/language/literals/string/shell.js b/js/src/tests/test262/annexB/language/literals/string/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/string/shell.js