summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/exec
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/exec')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/15.10.6.2-9-e-1.js18
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A11.js17
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A12.js15
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T1.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T10.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T11.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T12.js52
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T13.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T14.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T15.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T16.js15
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T17.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T18.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T19.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T2.js51
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T20.js52
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T21.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T3.js50
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T4.js52
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T5.js53
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T6.js52
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T7.js22
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T8.js22
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T9.js19
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T1.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T10.js26
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T2.js29
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T3.js29
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T4.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T5.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T6.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T7.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T8.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T9.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T1.js42
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T2.js153
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T3.js157
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T4.js159
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T5.js42
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T6.js42
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T7.js42
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T1.js80
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T10.js84
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T11.js60
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T12.js85
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T2.js82
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T3.js80
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T4.js80
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T5.js84
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T6.js80
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T7.js82
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T8.js80
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T9.js82
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T1.js53
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T2.js20
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T3.js26
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A6.js15
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A7.js25
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A8.js35
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A9.js33
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-groups-properties.js39
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-indices-groups-properties.js39
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-g-lastindex-reset.js54
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-access.js38
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-set.js74
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/name.js28
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/success-g-lastindex-no-access.js35
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/success-lastindex-access.js38
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js35
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-adv.js24
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-value.js32
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write.js38
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex.js35
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-return.js31
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/y-init-lastindex.js33
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/exec/y-set-lastindex.js27
80 files changed, 3736 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/15.10.6.2-9-e-1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/15.10.6.2-9-e-1.js
new file mode 100644
index 0000000000..ec873a700c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/15.10.6.2-9-e-1.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 15.10.6.2-9-e-1
+description: >
+ RegExp.prototype.exec - the removed step 9.e won't affected
+ current algorithm
+---*/
+
+ var str = "Hello World!";
+ var regObj = new RegExp("World");
+ var result = false;
+ result = regObj.exec(str).toString() === "World";
+
+assert(result, 'result !== true');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js
new file mode 100644
index 0000000000..30f70bedac
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.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.
+
+/*---
+info: The RegExp.prototype.exec.length property has the attribute ReadOnly
+es5id: 15.10.6.2_A10
+description: Checking if varying the RegExp.prototype.exec.length property fails
+includes: [propertyHelper.js]
+---*/
+assert.sameValue(
+ RegExp.prototype.exec.hasOwnProperty('length'),
+ true,
+ 'RegExp.prototype.exec.hasOwnProperty(\'length\') must return true'
+);
+
+var __obj = RegExp.prototype.exec.length;
+
+verifyNotWritable(RegExp.prototype.exec, "length", null, function(){return "shifted";});
+
+assert.sameValue(
+ RegExp.prototype.exec.length,
+ __obj,
+ 'The value of RegExp.prototype.exec.length is expected to equal the value of __obj'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A11.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A11.js
new file mode 100644
index 0000000000..2cd62c397f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A11.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: The length property of the exec method is 1
+es5id: 15.10.6.2_A11
+description: Checking RegExp.prototype.exec.length
+---*/
+assert.sameValue(
+ RegExp.prototype.exec.hasOwnProperty("length"),
+ true,
+ 'RegExp.prototype.exec.hasOwnProperty("length") must return true'
+);
+
+assert.sameValue(RegExp.prototype.exec.length, 1, 'The value of RegExp.prototype.exec.length is expected to be 1');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A12.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A12.js
new file mode 100644
index 0000000000..86c5b57945
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A12.js
@@ -0,0 +1,15 @@
+// Copyright 2011 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: regExp exec() acts like regExp.exec('undefined') (step 2)
+es5id: 15.10.6.2_A12
+description: Checking RegExp.prototype.exec
+---*/
+
+(/foo/).test('xfoox');
+var match = new RegExp('(.|\r|\n)*','').exec()[0];
+assert.notSameValue(match, 'xfoox', 'The value of match is not "xfoox"');
+assert.sameValue(match, 'undefined', 'The value of match is expected to be "undefined"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T1.js
new file mode 100644
index 0000000000..afbac70c61
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T1.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T1
+description: String is "123" and RegExp is /1|12/
+---*/
+
+var __executed = /1|12/.exec("123");
+
+var __expected = ["1"];
+__expected.index=0;
+__expected.input="123";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T10.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T10.js
new file mode 100644
index 0000000000..8da7239544
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T10.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T10
+description: String is 1.01 and RegExp is /1|12/
+---*/
+
+var __executed = /1|12/.exec(1.01);
+
+var __expected = ["1"];
+__expected.index=0;
+__expected.input="1.01";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T11.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T11.js
new file mode 100644
index 0000000000..826e9f1f0b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T11.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T11
+description: String is new Number(1.012) and RegExp is /2|12/
+---*/
+
+var __executed = /2|12/.exec(new Number(1.012));
+
+var __expected = ["12"];
+__expected.index=3;
+__expected.input="1.012";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T12.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T12.js
new file mode 100644
index 0000000000..25924e5aa6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T12.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T12
+description: >
+ String is {toString:function(){return Math.PI;}} and RegExp is
+ /\.14/
+---*/
+
+var __executed = /\.14/.exec({toString:function(){return Math.PI}});
+
+var __expected = [".14"];
+__expected.index=1;
+__expected.input=String(Math.PI);
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T13.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T13.js
new file mode 100644
index 0000000000..c727f0db2b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T13.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T13
+description: String is true and RegExp is /t[a-b|q-s]/
+---*/
+
+var __executed = /t[a-b|q-s]/.exec(true);
+
+var __expected = ["tr"];
+__expected.index=0;
+__expected.input="true";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T14.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T14.js
new file mode 100644
index 0000000000..4b447fc451
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T14.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T14
+description: String is new Boolean and RegExp is /AL|se/
+---*/
+
+var __executed = /AL|se/.exec(new Boolean);
+
+var __expected = ["se"];
+__expected.index=3;
+__expected.input="false";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T15.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T15.js
new file mode 100644
index 0000000000..37eb4c6689
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T15.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T15
+description: "String is {toString:function(){return false;}} and RegExp is /LS/i"
+---*/
+
+var __executed = /LS/i.exec({toString:function(){return false}});
+
+var __expected = ["ls"];
+__expected.index=2;
+__expected.input="false";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T16.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T16.js
new file mode 100644
index 0000000000..45318b1bf6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T16.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: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T16
+description: RegExp is /undefined/ and call exec() without arguments
+---*/
+
+var __re = /undefined/.exec()[0];
+assert.sameValue(__re, "undefined", 'The value of __re is expected to be "undefined"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T17.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T17.js
new file mode 100644
index 0000000000..ed4f5280de
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T17.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T17
+description: String is null and RegExp is /ll|l/
+---*/
+
+var __executed = /ll|l/.exec(null);
+
+var __expected = ["ll"];
+__expected.index=2;
+__expected.input="null";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T18.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T18.js
new file mode 100644
index 0000000000..4682802f69
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T18.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T18
+description: String is undefined and RegExp is /nd|ne/
+---*/
+
+var __executed = /nd|ne/.exec(undefined);
+
+var __expected = ["nd"];
+__expected.index=1;
+__expected.input="undefined";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T19.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T19.js
new file mode 100644
index 0000000000..1a904a79df
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T19.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T19
+description: String is void 0 and RegExp is /e{1}/
+---*/
+
+var __executed = /e{1}/.exec(void 0);
+
+var __expected = ["e"];
+__expected.index=3;
+__expected.input="undefined";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T2.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T2.js
new file mode 100644
index 0000000000..1260136aa1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T2.js
@@ -0,0 +1,51 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T2
+description: String is new String("123") and RegExp is /((1)|(12))((3)|(23))/
+---*/
+
+var __re = /((1)|(12))((3)|(23))/;
+var __executed = __re.exec(new String("123"));
+
+var __expected = ["123", "1", "1", undefined, "23", undefined, "23"];
+__expected.index=0;
+__expected.input="123";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T20.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T20.js
new file mode 100644
index 0000000000..338e7ef05f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T20.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T20
+description: String is x and RegExp is /[a-f]d/, where x is undefined variable
+---*/
+
+var __executed = /[a-f]d/.exec(x);
+
+var __expected = ["ed"];
+__expected.index=7;
+__expected.input="undefined";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T21.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T21.js
new file mode 100644
index 0000000000..f35ae8d538
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T21.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T21
+description: String is function(){}() and RegExp is /[a-z]n/
+---*/
+
+var __executed = /[a-z]n/.exec(function(){}());
+
+var __expected = ["un"];
+__expected.index=0;
+__expected.input="undefined";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T3.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T3.js
new file mode 100644
index 0000000000..c6e0d2f775
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T3.js
@@ -0,0 +1,50 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T3
+description: String is new Object("abcdefghi") and RegExp is /a[a-z]{2,4}/
+---*/
+
+var __executed = /a[a-z]{2,4}/.exec(new Object("abcdefghi"));
+
+var __expected = ["abcde"];
+__expected.index=0;
+__expected.input="abcdefghi";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T4.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T4.js
new file mode 100644
index 0000000000..fc4bdb79c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T4.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T4
+description: >
+ String is {toString:function(){return "abcdefghi";}} and RegExp is
+ /a[a-z]{2,4}?/
+---*/
+
+var __executed = /a[a-z]{2,4}?/.exec({toString:function(){return "abcdefghi"}});
+
+var __expected = ["abc"];
+__expected.index=0;
+__expected.input="abcdefghi";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T5.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T5.js
new file mode 100644
index 0000000000..228127b9cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T5.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T5
+description: >
+ String is {toString:function(){return {};},
+ valueOf:function(){return "aabaac";}} and RegExp is
+ /(aa|aabaac|ba|b|c)* /
+---*/
+
+var __executed = /(aa|aabaac|ba|b|c)*/.exec({toString:function(){return {};}, valueOf:function(){return "aabaac";}});
+
+var __expected = ["aaba", "ba"];
+__expected.index=0;
+__expected.input="aabaac";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T6.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T6.js
new file mode 100644
index 0000000000..a06db4b6eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T6.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T6
+description: >
+ String is (function(){return "zaacbbbcac"})() and RegExp is
+ /(z)((a+)?(b+)?(c))* /
+---*/
+
+var __executed = /(z)((a+)?(b+)?(c))*/.exec((function(){return "zaacbbbcac"})());
+
+var __expected = ["zaacbbbcac", "z", "ac", "a", undefined, "c"];
+__expected.index=0;
+__expected.input="zaacbbbcac";
+
+assert.sameValue(
+ __executed instanceof Array,
+ true,
+ 'The result of evaluating (__executed instanceof Array) is expected to be true'
+);
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T7.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T7.js
new file mode 100644
index 0000000000..8d51e48ea1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T7.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: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T7
+description: >
+ String is {toString:function(){throw "intostr";}} and RegExp is
+ /[a-z]/
+---*/
+
+try {
+ throw new Test262Error('#1.1: /[a-z]/.exec({toString:function(){throw "intostr"}}) throw "intostr". Actual: ' + (/[a-z]/.exec({toString:function(){throw "intostr"}})));
+} catch (e) {
+ assert.sameValue(e, "intostr", 'The value of e is expected to be "intostr"');
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T8.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T8.js
new file mode 100644
index 0000000000..c842675bb8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T8.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: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T8
+description: >
+ String is {toString:void 0, valueOf:function(){throw "invalof";}}
+ and RegExp is /[a-z]/
+---*/
+
+try {
+ throw new Test262Error('#1.1: /[a-z]/.exec({toString:void 0, valueOf:function(){throw "invalof"}}) throw "invalof". Actual: ' + (/[a-z]/.exec({toString:void 0, valueOf:function(){throw "invalof"}})));
+} catch (e) {
+ assert.sameValue(e, "invalof", 'The value of e is expected to be "invalof"');
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T9.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T9.js
new file mode 100644
index 0000000000..42bda957e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T9.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: |
+ RegExp.prototype.exec(string) Performs a regular expression match of ToString(string) against the regular expression and
+ returns an Array object containing the results of the match, or null if the string did not match
+es5id: 15.10.6.2_A1_T9
+description: String is undefined variable and RegExp is /1|12/
+---*/
+
+var __string;
+
+var __re = /1|12/;
+assert.sameValue(__re.exec(__string), null, '__re.exec() must return null');
+
+function __string(){}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T1.js
new file mode 100644
index 0000000000..160fe731cd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T1.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T1
+description: The internal [[Class]] property is "Object"
+---*/
+
+var __instance = new Object;
+
+__instance.exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: __instance = new Object; __instance.exec = RegExp.prototype.exec; __instance.exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T10.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T10.js
new file mode 100644
index 0000000000..377601dd09
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T10.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: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T10
+description: The tested object is undefined
+---*/
+
+var exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: exec = RegExp.prototype.exec; exec("message to investigate"). Actual: ' + (exec("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T2.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T2.js
new file mode 100644
index 0000000000..b00031334e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T2
+description: The tested object is Math
+---*/
+
+var __instance = Math;
+
+__instance.exec = RegExp.prototype.exec;
+
+try {
+ __instance.exec("message to investigate");
+ throw new Test262Error('#1.1: __instance = Math; __instance.exec = RegExp.prototype.exec; __instance.exec("message to investigate")');
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T3.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T3.js
new file mode 100644
index 0000000000..36cedabf51
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T3.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T3
+description: The tested object is function object
+---*/
+
+__instance.exec = RegExp.prototype.exec;
+
+try {
+ __instance.exec("message to investigate");
+ throw new Test262Error('#1.1: __instance.exec = RegExp.prototype.exec; __instance.exec("message to investigate"); function __instance(){}');
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+function __instance(){};
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T4.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T4.js
new file mode 100644
index 0000000000..5cf0ba8d34
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T4
+description: The tested object is new String("[a-b]")
+---*/
+
+var __instance = new String("[a-b]");
+
+__instance.exec = RegExp.prototype.exec;
+
+ try {
+ throw new Test262Error('#1.1: __instance = new String("[a-b]"); __instance.exec = RegExp.prototype.exec; exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+ } catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+ }
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T5.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T5.js
new file mode 100644
index 0000000000..4128d2a5c0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T5.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T5
+description: The tested object is new Boolean(false)
+---*/
+
+var __instance = new Boolean(false);
+
+__instance.exec = RegExp.prototype.exec;
+
+ try {
+ throw new Test262Error('#1.1: __instance = new Boolean(false); __instance.exec = RegExp.prototype.exec; exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+ } catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+ }
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T6.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T6.js
new file mode 100644
index 0000000000..ebbb2a8a2a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T6.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T6
+description: The tested object is new Number(1.0)
+---*/
+
+var __instance = new Number(1.0);
+
+__instance.exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: __instance = new Number(1.0); __instance.exec = RegExp.prototype.exec; __instance["exec"]("message to investigate"). Actual: ' + (__instance["exec"]("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T7.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T7.js
new file mode 100644
index 0000000000..be09f460f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T7.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T7
+description: The tested object is false
+---*/
+
+var __instance = false;
+
+Object.prototype.exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: __instance = false; Object.prototype.exec = RegExp.prototype.exec; __instance.exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T8.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T8.js
new file mode 100644
index 0000000000..4118289d6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T8.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T8
+description: The tested object is "."
+---*/
+
+var __instance = ".";
+
+Object.prototype.exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: __instance = "."; Object.prototype.exec = RegExp.prototype.exec; __instance.exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T9.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T9.js
new file mode 100644
index 0000000000..83f8f5945a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A2_T9.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.
+
+/*---
+info: |
+ A TypeError exception is thrown if the this value is not an object for
+ which the value of the internal [[Class]] property is "RegExp"
+es5id: 15.10.6.2_A2_T9
+description: The tested object is 1.0
+---*/
+
+var __instance = 1.0;
+
+Object.prototype.exec = RegExp.prototype.exec;
+
+try {
+ throw new Test262Error('#1.1: __instance = 1.0; Object.prototype.exec = RegExp.prototype.exec; __instance.exec("message to investigate"). Actual: ' + (__instance.exec("message to investigate")));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T1.js
new file mode 100644
index 0000000000..52d3ccc26d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T1.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T1
+description: "RegExp is /(?:ab|cd)\\d?/g and tested string is \"ab cd2 ab34 cd\""
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __matched = [];
+
+var __expected = ["ab", "cd2", "ab3", "cd"];
+
+do{
+ var __executed = __re.exec("ab cd2 ab34 cd");
+ if (__executed !== null) {
+ __matched.push(__executed[0]);
+ } else {
+ break;
+ }
+}while(true);
+
+assert.sameValue(
+ __expected.length,
+ __matched.length,
+ 'The value of __expected.length is expected to equal the value of __matched.length'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __expected[index],
+ __matched[index],
+ 'The value of __expected[index] is expected to equal the value of __matched[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T2.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T2.js
new file mode 100644
index 0000000000..2c9c8b5171
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T2.js
@@ -0,0 +1,153 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T2
+description: RegExp is /[Nn]evermore/g and tested string is very long string
+---*/
+
+var __the__raven = " Once upon a midnight dreary, while I pondered weak and weary," +
+ "Over many a quaint and curious volume of forgotten lore," +
+ "While I nodded, nearly napping, suddenly there came a tapping," +
+ "As of some one gently rapping, rapping at my chamber door." +
+ "`'Tis some visitor,' I muttered, `tapping at my chamber door -" +
+ "Only this, and nothing more.'" +
+ "Ah, distinctly I remember it was in the bleak December," +
+ "And each separate dying ember wrought its ghost upon the floor." +
+ "Eagerly I wished the morrow; - vainly I had sought to borrow" +
+ "From my books surcease of sorrow - sorrow for the lost Lenore -" +
+ "For the rare and radiant maiden whom the angels named Lenore -" +
+ "Nameless here for evermore." +
+ "\n" +
+ "And the silken sad uncertain rustling of each purple curtain" +
+ "Thrilled me - filled me with fantastic terrors never felt before;" +
+ "So that now, to still the beating of my heart, I stood repeating" +
+ "`'Tis some visitor entreating entrance at my chamber door -" +
+ "Some late visitor entreating entrance at my chamber door; -" +
+ "This it is, and nothing more,'" +
+ "Presently my soul grew stronger; hesitating then no longer," +
+ "`Sir,' said I, `or Madam, truly your forgiveness I implore;" +
+ "But the fact is I was napping, and so gently you came rapping," +
+ "And so faintly you came tapping, tapping at my chamber door," +
+ "That I scarce was sure I heard you' - here I opened wide the door; -" +
+ "Darkness there, and nothing more." +
+ "\n" +
+ "Deep into that darkness peering, long I stood there wondering, fearing," +
+ "Doubting, dreaming dreams no mortal ever dared to dream before" +
+ "But the silence was unbroken, and the darkness gave no token," +
+ "And the only word there spoken was the whispered word, `Lenore!'" +
+ "This I whispered, and an echo murmured back the word, `Lenore!'" +
+ "Merely this and nothing more." +
+ "\n" +
+ "Back into the chamber turning, all my soul within me burning," +
+ "Soon again I heard a tapping somewhat louder than before." +
+ "`Surely,' said I, `surely that is something at my window lattice;" +
+ "Let me see then, what thereat is, and this mystery explore -" +
+ "Let my heart be still a moment and this mystery explore; -" +
+ "'Tis the wind and nothing more!'" +
+ "\n" +
+ "Open here I flung the shutter, when, with many a flirt and flutter," +
+ "In there stepped a stately raven of the saintly days of yore." +
+ "Not the least obeisance made he; not a minute stopped or stayed he;" +
+ "But, with mien of lord or lady, perched above my chamber door -" +
+ "Perched upon a bust of Pallas just above my chamber door -" +
+ "Perched, and sat, and nothing more." +
+ "\n" +
+ "Then this ebony bird beguiling my sad fancy into smiling," +
+ "By the grave and stern decorum of the countenance it wore," +
+ "`Though thy crest be shorn and shaven, thou,' I said, `art sure no craven." +
+ "Ghastly grim and ancient raven wandering from the nightly shore -" +
+ "Tell me what thy lordly name is on the Night's Plutonian shore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "-n" +
+ "Much I marvelled this ungainly fowl to hear discourse so plainly," +
+ "Though its answer little meaning - little relevancy bore;" +
+ "For we cannot help agreeing that no living human being" +
+ "Ever yet was blessed with seeing bird above his chamber door -" +
+ "Bird or beast above the sculptured bust above his chamber door," +
+ "With such name as `Nevermore.'" +
+ "\n" +
+ "But the raven, sitting lonely on the placid bust, spoke only," +
+ "That one word, as if his soul in that one word he did outpour." +
+ "Nothing further then he uttered - not a feather then he fluttered -" +
+ "Till I scarcely more than muttered `Other friends have flown before -" +
+ "On the morrow he will leave me, as my hopes have flown before.'" +
+ "Then the bird said, `Nevermore.'" +
+ "\n" +
+ "Startled at the stillness broken by reply so aptly spoken," +
+ "`Doubtless,' said I, `what it utters is its only stock and store," +
+ "Caught from some unhappy master whom unmerciful disaster" +
+ "Followed fast and followed faster till his songs one burden bore -" +
+ "Till the dirges of his hope that melancholy burden bore" +
+ "Of \"Never-nevermore.\"'" +
+ "\n" +
+ "But the raven still beguiling all my sad soul into smiling," +
+ "Straight I wheeled a cushioned seat in front of bird and bust and door;" +
+ "Then, upon the velvet sinking, I betook myself to linking" +
+ "Fancy unto fancy, thinking what this ominous bird of yore -" +
+ "What this grim, ungainly, ghastly, gaunt, and ominous bird of yore" +
+ "Meant in croaking `Nevermore.'" +
+ "\n" +
+ "This I sat engaged in guessing, but no syllable expressing" +
+ "To the fowl whose fiery eyes now burned into my bosom's core;" +
+ "This and more I sat divining, with my head at ease reclining" +
+ "On the cushion's velvet lining that the lamp-light gloated o'er," +
+ "But whose velvet violet lining with the lamp-light gloating o'er," +
+ "She shall press, ah, nevermore!" +
+ "\n" +
+ "Then, methought, the air grew denser, perfumed from an unseen censer" +
+ "Swung by Seraphim whose foot-falls tinkled on the tufted floor." +
+ "`Wretch,' I cried, `thy God hath lent thee - by these angels he has sent thee" +
+ "Respite - respite and nepenthe from thy memories of Lenore!" +
+ "Quaff, oh quaff this kind nepenthe, and forget this lost Lenore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil! -" +
+ "Whether tempter sent, or whether tempest tossed thee here ashore," +
+ "Desolate yet all undaunted, on this desert land enchanted -" +
+ "On this home by horror haunted - tell me truly, I implore -" +
+ "Is there - is there balm in Gilead? - tell me - tell me, I implore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil!" +
+ "By that Heaven that bends above us - by that God we both adore -" +
+ "Tell this soul with sorrow laden if, within the distant Aidenn," +
+ "It shall clasp a sainted maiden whom the angels named Lenore -" +
+ "Clasp a rare and radiant maiden, whom the angels named Lenore?'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Be that word our sign of parting, bird or fiend!' I shrieked upstarting -" +
+ "`Get thee back into the tempest and the Night's Plutonian shore!" +
+ "Leave no black plume as a token of that lie thy soul hath spoken!" +
+ "Leave my loneliness unbroken! - quit the bust above my door!" +
+ "Take thy beak from out my heart, and take thy form from off my door!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "And the raven, never flitting, still is sitting, still is sitting" +
+ "On the pallid bust of Pallas just above my chamber door;" +
+ "And his eyes have all the seeming of a demon's that is dreaming," +
+ "And the lamp-light o'er him streaming throws his shadow on the floor;" +
+ "And my soul from out that shadow that lies floating on the floor" +
+ "Shall be lifted - nevermore!"
+
+var NEVERMORE=11;
+
+var __re = /[Nn]evermore/g;
+var __matched=0;
+
+do{
+ var __executed = __re.exec(__the__raven);
+ if (__executed !== null) {
+ __matched++;
+ } else {
+ break;
+ }
+}while(1);
+
+assert.sameValue(__matched, NEVERMORE, 'The value of __matched is expected to equal the value of NEVERMORE');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T3.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T3.js
new file mode 100644
index 0000000000..dec512cc87
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T3.js
@@ -0,0 +1,157 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T3
+description: RegExp is /[Nn]?evermore/g and tested string is very long string
+---*/
+
+var __the__raven = " Once upon a midnight dreary, while I pondered weak and weary," +
+ "Over many a quaint and curious volume of forgotten lore," +
+ "While I nodded, nearly napping, suddenly there came a tapping," +
+ "As of some one gently rapping, rapping at my chamber door." +
+ "`'Tis some visitor,' I muttered, `tapping at my chamber door -" +
+ "Only this, and nothing more.'" +
+ "Ah, distinctly I remember it was in the bleak December," +
+ "And each separate dying ember wrought its ghost upon the floor." +
+ "Eagerly I wished the morrow; - vainly I had sought to borrow" +
+ "From my books surcease of sorrow - sorrow for the lost Lenore -" +
+ "For the rare and radiant maiden whom the angels named Lenore -" +
+ "Nameless here for evermore." +
+ "\n" +
+ "And the silken sad uncertain rustling of each purple curtain" +
+ "Thrilled me - filled me with fantastic terrors never felt before;" +
+ "So that now, to still the beating of my heart, I stood repeating" +
+ "`'Tis some visitor entreating entrance at my chamber door -" +
+ "Some late visitor entreating entrance at my chamber door; -" +
+ "This it is, and nothing more,'" +
+ "Presently my soul grew stronger; hesitating then no longer," +
+ "`Sir,' said I, `or Madam, truly your forgiveness I implore;" +
+ "But the fact is I was napping, and so gently you came rapping," +
+ "And so faintly you came tapping, tapping at my chamber door," +
+ "That I scarce was sure I heard you' - here I opened wide the door; -" +
+ "Darkness there, and nothing more." +
+ "\n" +
+ "Deep into that darkness peering, long I stood there wondering, fearing," +
+ "Doubting, dreaming dreams no mortal ever dared to dream before" +
+ "But the silence was unbroken, and the darkness gave no token," +
+ "And the only word there spoken was the whispered word, `Lenore!'" +
+ "This I whispered, and an echo murmured back the word, `Lenore!'" +
+ "Merely this and nothing more." +
+ "\n" +
+ "Back into the chamber turning, all my soul within me burning," +
+ "Soon again I heard a tapping somewhat louder than before." +
+ "`Surely,' said I, `surely that is something at my window lattice;" +
+ "Let me see then, what thereat is, and this mystery explore -" +
+ "Let my heart be still a moment and this mystery explore; -" +
+ "'Tis the wind and nothing more!'" +
+ "\n" +
+ "Open here I flung the shutter, when, with many a flirt and flutter," +
+ "In there stepped a stately raven of the saintly days of yore." +
+ "Not the least obeisance made he; not a minute stopped or stayed he;" +
+ "But, with mien of lord or lady, perched above my chamber door -" +
+ "Perched upon a bust of Pallas just above my chamber door -" +
+ "Perched, and sat, and nothing more." +
+ "\n" +
+ "Then this ebony bird beguiling my sad fancy into smiling," +
+ "By the grave and stern decorum of the countenance it wore," +
+ "`Though thy crest be shorn and shaven, thou,' I said, `art sure no craven." +
+ "Ghastly grim and ancient raven wandering from the nightly shore -" +
+ "Tell me what thy lordly name is on the Night's Plutonian shore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "-n" +
+ "Much I marvelled this ungainly fowl to hear discourse so plainly," +
+ "Though its answer little meaning - little relevancy bore;" +
+ "For we cannot help agreeing that no living human being" +
+ "Ever yet was blessed with seeing bird above his chamber door -" +
+ "Bird or beast above the sculptured bust above his chamber door," +
+ "With such name as `Nevermore.'" +
+ "\n" +
+ "But the raven, sitting lonely on the placid bust, spoke only," +
+ "That one word, as if his soul in that one word he did outpour." +
+ "Nothing further then he uttered - not a feather then he fluttered -" +
+ "Till I scarcely more than muttered `Other friends have flown before -" +
+ "On the morrow he will leave me, as my hopes have flown before.'" +
+ "Then the bird said, `Nevermore.'" +
+ "\n" +
+ "Startled at the stillness broken by reply so aptly spoken," +
+ "`Doubtless,' said I, `what it utters is its only stock and store," +
+ "Caught from some unhappy master whom unmerciful disaster" +
+ "Followed fast and followed faster till his songs one burden bore -" +
+ "Till the dirges of his hope that melancholy burden bore" +
+ "Of \"Never-nevermore.\"'" +
+ "\n" +
+ "But the raven still beguiling all my sad soul into smiling," +
+ "Straight I wheeled a cushioned seat in front of bird and bust and door;" +
+ "Then, upon the velvet sinking, I betook myself to linking" +
+ "Fancy unto fancy, thinking what this ominous bird of yore -" +
+ "What this grim, ungainly, ghastly, gaunt, and ominous bird of yore" +
+ "Meant in croaking `Nevermore.'" +
+ "\n" +
+ "This I sat engaged in guessing, but no syllable expressing" +
+ "To the fowl whose fiery eyes now burned into my bosom's core;" +
+ "This and more I sat divining, with my head at ease reclining" +
+ "On the cushion's velvet lining that the lamp-light gloated o'er," +
+ "But whose velvet violet lining with the lamp-light gloating o'er," +
+ "She shall press, ah, nevermore!" +
+ "\n" +
+ "Then, methought, the air grew denser, perfumed from an unseen censer" +
+ "Swung by Seraphim whose foot-falls tinkled on the tufted floor." +
+ "`Wretch,' I cried, `thy God hath lent thee - by these angels he has sent thee" +
+ "Respite - respite and nepenthe from thy memories of Lenore!" +
+ "Quaff, oh quaff this kind nepenthe, and forget this lost Lenore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil! -" +
+ "Whether tempter sent, or whether tempest tossed thee here ashore," +
+ "Desolate yet all undaunted, on this desert land enchanted -" +
+ "On this home by horror haunted - tell me truly, I implore -" +
+ "Is there - is there balm in Gilead? - tell me - tell me, I implore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil!" +
+ "By that Heaven that bends above us - by that God we both adore -" +
+ "Tell this soul with sorrow laden if, within the distant Aidenn," +
+ "It shall clasp a sainted maiden whom the angels named Lenore -" +
+ "Clasp a rare and radiant maiden, whom the angels named Lenore?'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Be that word our sign of parting, bird or fiend!' I shrieked upstarting -" +
+ "`Get thee back into the tempest and the Night's Plutonian shore!" +
+ "Leave no black plume as a token of that lie thy soul hath spoken!" +
+ "Leave my loneliness unbroken! - quit the bust above my door!" +
+ "Take thy beak from out my heart, and take thy form from off my door!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "And the raven, never flitting, still is sitting, still is sitting" +
+ "On the pallid bust of Pallas just above my chamber door;" +
+ "And his eyes have all the seeming of a demon's that is dreaming," +
+ "And the lamp-light o'er him streaming throws his shadow on the floor;" +
+ "And my soul from out that shadow that lies floating on the floor" +
+ "Shall be lifted - nevermore!"
+
+var NEVERMORE_AND_EVERMORE=12;
+
+var __re = /[Nn]?evermore/g;
+var __matched=0;
+
+do{
+ var __executed = __re.exec(__the__raven);
+ if (__executed !== null) {
+ __matched++;
+ } else {
+ break;
+ }
+}while(1);
+
+assert.sameValue(
+ __matched,
+ NEVERMORE_AND_EVERMORE,
+ 'The value of __matched is expected to equal the value of NEVERMORE_AND_EVERMORE'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T4.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T4.js
new file mode 100644
index 0000000000..dd54ccca23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T4.js
@@ -0,0 +1,159 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T4
+description: >
+ RegExp is /([Nn]?ever|([Nn]othing\s{1,}))more/g and tested string
+ is very long string
+---*/
+
+var __the__raven = " Once upon a midnight dreary, while I pondered weak and weary," +
+ "Over many a quaint and curious volume of forgotten lore," +
+ "While I nodded, nearly napping, suddenly there came a tapping," +
+ "As of some one gently rapping, rapping at my chamber door." +
+ "`'Tis some visitor,' I muttered, `tapping at my chamber door -" +
+ "Only this, and nothing more.'" +
+ "Ah, distinctly I remember it was in the bleak December," +
+ "And each separate dying ember wrought its ghost upon the floor." +
+ "Eagerly I wished the morrow; - vainly I had sought to borrow" +
+ "From my books surcease of sorrow - sorrow for the lost Lenore -" +
+ "For the rare and radiant maiden whom the angels named Lenore -" +
+ "Nameless here for evermore." +
+ "\n" +
+ "And the silken sad uncertain rustling of each purple curtain" +
+ "Thrilled me - filled me with fantastic terrors never felt before;" +
+ "So that now, to still the beating of my heart, I stood repeating" +
+ "`'Tis some visitor entreating entrance at my chamber door -" +
+ "Some late visitor entreating entrance at my chamber door; -" +
+ "This it is, and nothing more,'" +
+ "Presently my soul grew stronger; hesitating then no longer," +
+ "`Sir,' said I, `or Madam, truly your forgiveness I implore;" +
+ "But the fact is I was napping, and so gently you came rapping," +
+ "And so faintly you came tapping, tapping at my chamber door," +
+ "That I scarce was sure I heard you' - here I opened wide the door; -" +
+ "Darkness there, and nothing more." +
+ "\n" +
+ "Deep into that darkness peering, long I stood there wondering, fearing," +
+ "Doubting, dreaming dreams no mortal ever dared to dream before" +
+ "But the silence was unbroken, and the darkness gave no token," +
+ "And the only word there spoken was the whispered word, `Lenore!'" +
+ "This I whispered, and an echo murmured back the word, `Lenore!'" +
+ "Merely this and nothing more." +
+ "\n" +
+ "Back into the chamber turning, all my soul within me burning," +
+ "Soon again I heard a tapping somewhat louder than before." +
+ "`Surely,' said I, `surely that is something at my window lattice;" +
+ "Let me see then, what thereat is, and this mystery explore -" +
+ "Let my heart be still a moment and this mystery explore; -" +
+ "'Tis the wind and nothing more!'" +
+ "\n" +
+ "Open here I flung the shutter, when, with many a flirt and flutter," +
+ "In there stepped a stately raven of the saintly days of yore." +
+ "Not the least obeisance made he; not a minute stopped or stayed he;" +
+ "But, with mien of lord or lady, perched above my chamber door -" +
+ "Perched upon a bust of Pallas just above my chamber door -" +
+ "Perched, and sat, and nothing more." +
+ "\n" +
+ "Then this ebony bird beguiling my sad fancy into smiling," +
+ "By the grave and stern decorum of the countenance it wore," +
+ "`Though thy crest be shorn and shaven, thou,' I said, `art sure no craven." +
+ "Ghastly grim and ancient raven wandering from the nightly shore -" +
+ "Tell me what thy lordly name is on the Night's Plutonian shore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "-n" +
+ "Much I marvelled this ungainly fowl to hear discourse so plainly," +
+ "Though its answer little meaning - little relevancy bore;" +
+ "For we cannot help agreeing that no living human being" +
+ "Ever yet was blessed with seeing bird above his chamber door -" +
+ "Bird or beast above the sculptured bust above his chamber door," +
+ "With such name as `Nevermore.'" +
+ "\n" +
+ "But the raven, sitting lonely on the placid bust, spoke only," +
+ "That one word, as if his soul in that one word he did outpour." +
+ "Nothing further then he uttered - not a feather then he fluttered -" +
+ "Till I scarcely more than muttered `Other friends have flown before -" +
+ "On the morrow he will leave me, as my hopes have flown before.'" +
+ "Then the bird said, `Nevermore.'" +
+ "\n" +
+ "Startled at the stillness broken by reply so aptly spoken," +
+ "`Doubtless,' said I, `what it utters is its only stock and store," +
+ "Caught from some unhappy master whom unmerciful disaster" +
+ "Followed fast and followed faster till his songs one burden bore -" +
+ "Till the dirges of his hope that melancholy burden bore" +
+ "Of \"Never-nevermore.\"'" +
+ "\n" +
+ "But the raven still beguiling all my sad soul into smiling," +
+ "Straight I wheeled a cushioned seat in front of bird and bust and door;" +
+ "Then, upon the velvet sinking, I betook myself to linking" +
+ "Fancy unto fancy, thinking what this ominous bird of yore -" +
+ "What this grim, ungainly, ghastly, gaunt, and ominous bird of yore" +
+ "Meant in croaking `Nevermore.'" +
+ "\n" +
+ "This I sat engaged in guessing, but no syllable expressing" +
+ "To the fowl whose fiery eyes now burned into my bosom's core;" +
+ "This and more I sat divining, with my head at ease reclining" +
+ "On the cushion's velvet lining that the lamp-light gloated o'er," +
+ "But whose velvet violet lining with the lamp-light gloating o'er," +
+ "She shall press, ah, nevermore!" +
+ "\n" +
+ "Then, methought, the air grew denser, perfumed from an unseen censer" +
+ "Swung by Seraphim whose foot-falls tinkled on the tufted floor." +
+ "`Wretch,' I cried, `thy God hath lent thee - by these angels he has sent thee" +
+ "Respite - respite and nepenthe from thy memories of Lenore!" +
+ "Quaff, oh quaff this kind nepenthe, and forget this lost Lenore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil! -" +
+ "Whether tempter sent, or whether tempest tossed thee here ashore," +
+ "Desolate yet all undaunted, on this desert land enchanted -" +
+ "On this home by horror haunted - tell me truly, I implore -" +
+ "Is there - is there balm in Gilead? - tell me - tell me, I implore!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Prophet!' said I, `thing of evil! - prophet still, if bird or devil!" +
+ "By that Heaven that bends above us - by that God we both adore -" +
+ "Tell this soul with sorrow laden if, within the distant Aidenn," +
+ "It shall clasp a sainted maiden whom the angels named Lenore -" +
+ "Clasp a rare and radiant maiden, whom the angels named Lenore?'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "`Be that word our sign of parting, bird or fiend!' I shrieked upstarting -" +
+ "`Get thee back into the tempest and the Night's Plutonian shore!" +
+ "Leave no black plume as a token of that lie thy soul hath spoken!" +
+ "Leave my loneliness unbroken! - quit the bust above my door!" +
+ "Take thy beak from out my heart, and take thy form from off my door!'" +
+ "Quoth the raven, `Nevermore.'" +
+ "\n" +
+ "And the raven, never flitting, still is sitting, still is sitting" +
+ "On the pallid bust of Pallas just above my chamber door;" +
+ "And his eyes have all the seeming of a demon's that is dreaming," +
+ "And the lamp-light o'er him streaming throws his shadow on the floor;" +
+ "And my soul from out that shadow that lies floating on the floor" +
+ "Shall be lifted - nevermore!"
+
+var ALL_THE_HOPELESS_MORE=18;
+
+var __re = /([Nn]?ever|([Nn]othing\s{1,}))more/g;
+var __matched=0;
+
+do{
+ var __executed = __re.exec(__the__raven);
+ if (__executed !== null) {
+ __matched++;
+ } else {
+ break;
+ }
+}while(1);
+
+assert.sameValue(
+ __matched,
+ ALL_THE_HOPELESS_MORE,
+ 'The value of __matched is expected to equal the value of ALL_THE_HOPELESS_MORE'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T5.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T5.js
new file mode 100644
index 0000000000..a457312611
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T5.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T5
+description: RegExp is /\d+/g and tested string is "123 456 789"
+---*/
+
+var __re = /\d+/g;
+
+var __matched = [];
+
+var __expected = ["123","456","789"];
+
+do{
+ var __executed = __re.exec("123 456 789");
+ if (__executed !== null) {
+ __matched.push(__executed[0]);
+ } else {
+ break;
+ }
+}while(true);
+
+assert.sameValue(
+ __expected.length,
+ __matched.length,
+ 'The value of __expected.length is expected to equal the value of __matched.length'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __expected[index],
+ __matched[index],
+ 'The value of __expected[index] is expected to equal the value of __matched[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T6.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T6.js
new file mode 100644
index 0000000000..4c4c1491a6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T6.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T6
+description: RegExp is /(\d+)/g and tested string is "123 456 789"
+---*/
+
+var __re = /(\d+)/g;
+
+var __matched = [];
+
+var __expected = ["123","456","789"];
+
+do{
+ var __executed = __re.exec("123 456 789");
+ if (__executed !== null) {
+ __matched.push(__executed[0]);
+ } else {
+ break;
+ }
+}while(true);
+
+assert.sameValue(
+ __expected.length,
+ __matched.length,
+ 'The value of __expected.length is expected to equal the value of __matched.length'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __expected[index],
+ __matched[index],
+ 'The value of __expected[index] is expected to equal the value of __matched[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T7.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T7.js
new file mode 100644
index 0000000000..75232f1ea3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A3_T7.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true and lastIndex not changed manually,
+ next exec calling start to match from position where current match finished
+es5id: 15.10.6.2_A3_T7
+description: RegExp is /\d+/ and tested string is "123 456 789"
+---*/
+
+var __re = /\d+/;
+
+var __matched = [];
+
+var __expected = ["123","123","123","123","123","123","123","123","123","123"];
+
+do{
+ var __executed = __re.exec("123 456 789");
+ if (__executed !== null) {
+ __matched.push(__executed[0]);
+ } else {
+ break;
+ }
+}while(__matched.length<10);
+
+assert.sameValue(
+ __expected.length,
+ __matched.length,
+ 'The value of __expected.length is expected to equal the value of __matched.length'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __expected[index],
+ __matched[index],
+ 'The value of __expected[index] is expected to equal the value of __matched[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T1.js
new file mode 100644
index 0000000000..22fa388398
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T1.js
@@ -0,0 +1,80 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T1
+description: Call first exec, then set re.lastIndex = 12 and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = 12;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["ab4"];
+__expected.index = 17;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T10.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T10.js
new file mode 100644
index 0000000000..5c3cbd0ff4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T10.js
@@ -0,0 +1,84 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T10
+description: >
+ Call first exec, then set re.lastIndex =
+ {valueOf:function(){return 12;}} and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+var __obj = {valueOf:function(){return 12;}};
+
+__re.lastIndex = __obj;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["ab4"];
+__expected.index = 17;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T11.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T11.js
new file mode 100644
index 0000000000..6d8559da56
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T11.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T11
+description: >
+ Call first exec, then set re.lastIndex = {valueOf:function(){throw
+ "intoint";}} and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+var __obj = {valueOf:function(){throw "intoint";}};
+
+__re.lastIndex = __obj;
+
+try {
+ throw new Test262Error('#5.1: __obj = {valueOf:function(){throw "intoint";}}; __re.lastIndex = __obj; __executed = __re.exec("aacd2233ab12nm444ab42") throw "intoint". Actual: ' + (__re.exec("aacd2233ab12nm444ab42")));
+} catch (e) {
+ assert.sameValue(e, "intoint", 'The value of e is expected to be "intoint"');
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T12.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T12.js
new file mode 100644
index 0000000000..f9e6a6df38
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T12.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: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T12
+description: >
+ Call first exec, then set re.lastIndex =
+ {toString:function(){return 12;},valueOf:function(){return {};}}
+ and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+var __obj = {toString:function(){return 12;},valueOf:function(){return {};}};
+
+__re.lastIndex = __obj;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["ab4"];
+__expected.index = 17;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T2.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T2.js
new file mode 100644
index 0000000000..cc3d4a67ee
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T2.js
@@ -0,0 +1,82 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T2
+description: >
+ Call first exec, then set re.lastIndex = undefined and again call
+ exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = undefined;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T3.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T3.js
new file mode 100644
index 0000000000..eec144fd72
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T3.js
@@ -0,0 +1,80 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T3
+description: Call first exec, then set re.lastIndex = void 0 and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = void 0;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T4.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T4.js
new file mode 100644
index 0000000000..b87cb4b9f0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T4.js
@@ -0,0 +1,80 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T4
+description: Call first exec, then set re.lastIndex = null and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = null;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T5.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T5.js
new file mode 100644
index 0000000000..00e8e21fc3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T5.js
@@ -0,0 +1,84 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T5
+description: >
+ Call first exec, then set re.lastIndex = x and again call exec,
+ where x is undefined variable
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = x;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T6.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T6.js
new file mode 100644
index 0000000000..ccd2eff07c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T6.js
@@ -0,0 +1,80 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T6
+description: Call first exec, then set re.lastIndex = false and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = false;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T7.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T7.js
new file mode 100644
index 0000000000..5d90fa0435
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T7.js
@@ -0,0 +1,82 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T7
+description: >
+ Call first exec, then set re.lastIndex = Math.NaN and again call
+ exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = Math.NaN;
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T8.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T8.js
new file mode 100644
index 0000000000..77c7f9c4d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T8.js
@@ -0,0 +1,80 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T8
+description: Call first exec, then set re.lastIndex = "12" and again call exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = "12";
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["ab4"];
+__expected.index = 17;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T9.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T9.js
new file mode 100644
index 0000000000..dc4902a6bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A4_T9.js
@@ -0,0 +1,82 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ If global is true next exec calling start to match from lastIndex position
+es5id: 15.10.6.2_A4_T9
+description: >
+ Call first exec, then set re.lastIndex = "eleven" and again call
+ exec
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+
+var __executed = __re.exec("aacd2233ab12nm444ab42");
+
+var __expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__re.lastIndex = "eleven";
+
+__executed = __re.exec("aacd2233ab12nm444ab42");
+
+__expected = ["cd2"];
+__expected.index = 2;
+__expected.input = "aacd2233ab12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T1.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T1.js
new file mode 100644
index 0000000000..c290de421b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T1.js
@@ -0,0 +1,53 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ Let global is true and let I = If ToInteger(lastIndex).
+ Then if I<0 orI>length then set lastIndex to 0 and return null
+es5id: 15.10.6.2_A5_T1
+description: >
+ First call /(?:ab|cd)\d?/g.exec("aac1dz2233a1bz12nm444ab42"), and
+ then First call /(?:ab|cd)\d?/g.exec("aacd22")
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+var __executed = __re.exec("aac1dz2233a1bz12nm444ab42");
+
+var __expected = ["ab4"];
+__expected.index = 21;
+__expected.input = "aac1dz2233a1bz12nm444ab42";
+
+assert.sameValue(
+ __executed.length,
+ __expected.length,
+ 'The value of __executed.length is expected to equal the value of __expected.length'
+);
+
+assert.sameValue(
+ __executed.index,
+ __expected.index,
+ 'The value of __executed.index is expected to equal the value of __expected.index'
+);
+
+assert.sameValue(
+ __executed.input,
+ __expected.input,
+ 'The value of __executed.input is expected to equal the value of __expected.input'
+);
+
+for(var index=0; index<__expected.length; index++) {
+ assert.sameValue(
+ __executed[index],
+ __expected[index],
+ 'The value of __executed[index] is expected to equal the value of __expected[index]'
+ );
+}
+
+__executed = __re.exec("aacd22");
+
+assert(!__executed, 'The value of !__executed is expected to be true');
+assert.sameValue(__re.lastIndex, 0, 'The value of __re.lastIndex is expected to be 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T2.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T2.js
new file mode 100644
index 0000000000..5661d8d609
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on global property.
+ Let global is true and let I = If ToInteger(lastIndex).
+ Then if I<0 orI>length then set lastIndex to 0 and return null
+es5id: 15.10.6.2_A5_T2
+description: "Set lastIndex to 100 and call /(?:ab|cd)\\d?/g.exec(\"aacd22 \")"
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+__re.lastIndex=100;
+var __executed = __re.exec("aacd22 ");
+
+assert(!__executed, 'The value of !__executed is expected to be true');
+assert.sameValue(__re.lastIndex, 0, 'The value of __re.lastIndex is expected to be 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T3.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T3.js
new file mode 100644
index 0000000000..274ae6775f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T3.js
@@ -0,0 +1,26 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ RegExp.prototype.exec behavior depends on the lastIndex property:
+ ToLength(lastIndex) is the starting point for the search, so
+ negative numbers result in searching from 0.
+es5id: 15.10.6.2_A5_T3
+description: "Set lastIndex to -1 and call /(?:ab|cd)\\d?/g.exec(\"aacd22 \")"
+---*/
+
+var __re = /(?:ab|cd)\d?/g;
+__re.lastIndex=-1;
+var __executed = __re.exec("aacd22 ");
+
+assert.sameValue(__executed[0], "cd2", 'The value of __executed[0] is expected to be "cd2"');
+assert.sameValue(__re.lastIndex, 5, 'The value of __re.lastIndex is expected to be 5');
+
+__re.lastIndex=-100;
+__executed = __re.exec("aacd22 ");
+
+assert.sameValue(__executed[0], "cd2", 'The value of __executed[0] is expected to be "cd2"');
+assert.sameValue(__re.lastIndex, 5, 'The value of __re.lastIndex is expected to be 5');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A6.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A6.js
new file mode 100644
index 0000000000..87f4b0238f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A6.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: RegExp.prototype.exec has not prototype property
+es5id: 15.10.6.2_A6
+description: Checking RegExp.prototype.exec.prototype
+---*/
+assert.sameValue(
+ RegExp.prototype.exec.prototype,
+ undefined,
+ 'The value of RegExp.prototype.exec.prototype is expected to equal undefined'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A7.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A7.js
new file mode 100644
index 0000000000..f5ac4392c1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A7.js
@@ -0,0 +1,25 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: RegExp.prototype.exec can't be used as constructor
+es5id: 15.10.6.2_A7
+description: Checking if creating the RegExp.prototype.exec object fails
+---*/
+
+var __FACTORY = RegExp.prototype.exec;
+
+try {
+ var __instance = new __FACTORY;
+ throw new Test262Error('#1.1: __FACTORY = RegExp.prototype.exec throw TypeError. Actual: ' + (__instance));
+} catch (e) {
+ assert.sameValue(
+ e instanceof TypeError,
+ true,
+ 'The result of evaluating (e instanceof TypeError) is expected to be true'
+ );
+}
+
+// TODO: Convert to assert.throws() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A8.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A8.js
new file mode 100644
index 0000000000..bef663772f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A8.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: The RegExp.prototype.exec.length property has the attribute DontEnum
+es5id: 15.10.6.2_A8
+description: >
+ Checking if enumerating the RegExp.prototype.exec.length property
+ fails
+---*/
+assert.sameValue(
+ RegExp.prototype.exec.hasOwnProperty('length'),
+ true,
+ 'RegExp.prototype.exec.hasOwnProperty(\'length\') must return true'
+);
+
+assert.sameValue(
+ RegExp.prototype.exec.propertyIsEnumerable('length'),
+ false,
+ 'RegExp.prototype.exec.propertyIsEnumerable(\'length\') must return false'
+);
+
+var count=0;
+
+for (var p in RegExp.prototype.exec){
+ if (p==="length") {
+ count++;
+ }
+}
+
+assert.sameValue(count, 0, 'The value of count is expected to be 0');
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A9.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A9.js
new file mode 100644
index 0000000000..ec0dda3895
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/S15.10.6.2_A9.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The RegExp.prototype.exec.length property does not have the attribute
+ DontDelete
+es5id: 15.10.6.2_A9
+description: >
+ Checking if deleting the RegExp.prototype.exec.length property
+ fails
+---*/
+assert.sameValue(
+ RegExp.prototype.exec.hasOwnProperty('length'),
+ true,
+ 'RegExp.prototype.exec.hasOwnProperty(\'length\') must return true'
+);
+
+assert.sameValue(
+ delete RegExp.prototype.exec.length,
+ true,
+ 'The value of `delete RegExp.prototype.exec.length` is expected to be true'
+);
+
+assert.sameValue(
+ RegExp.prototype.exec.hasOwnProperty('length'),
+ false,
+ 'RegExp.prototype.exec.hasOwnProperty(\'length\') must return false'
+);
+
+// TODO: Convert to verifyProperty() format.
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/browser.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/browser.js
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-groups-properties.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-groups-properties.js
new file mode 100644
index 0000000000..890f8302b3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-groups-properties.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- regexp-duplicate-named-groups is not supported
+// Copyright 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Properties on groups object with duplicate named capture groups
+esid: prod-GroupSpecifier
+features: [regexp-duplicate-named-groups]
+includes: [compareArray.js]
+---*/
+
+const matcher = /(?:(?<x>a)|(?<y>a)(?<x>b))(?:(?<z>c)|(?<z>d))/;
+
+const threeMatchResult = matcher.exec("abc");
+assert.sameValue(threeMatchResult.groups.x, "b", "group x matches b");
+assert.sameValue(threeMatchResult.groups.y, "a", "group y matches a");
+assert.sameValue(threeMatchResult.groups.z, "c", "group z matches c");
+assert.compareArray(
+ Object.keys(threeMatchResult.groups),
+ ["x", "y", "z"],
+ "Properties of groups are ordered in RegExp source order despite y matching before x in this alternative"
+);
+
+const twoMatchResult = matcher.exec("ad");
+assert.sameValue(twoMatchResult.groups.x, "a", "group x matches a");
+assert.sameValue(twoMatchResult.groups.y, undefined, "group y does not match");
+assert.sameValue(twoMatchResult.groups.z, "d", "group z matches d");
+assert.compareArray(
+ Object.keys(twoMatchResult.groups),
+ ["x", "y", "z"],
+ "y is still present on groups object, in the right order, despite not matching"
+);
+
+const iteratedMatcher = /(?:(?:(?<x>a)|(?<x>b)|c)\k<x>){2}/;
+
+const matchedInPrevIterationResult = iteratedMatcher.exec("aac");
+assert.sameValue(matchedInPrevIterationResult.groups.x, undefined, "group x does not match in the last iteration");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-indices-groups-properties.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-indices-groups-properties.js
new file mode 100644
index 0000000000..ca0faac957
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/duplicate-named-indices-groups-properties.js
@@ -0,0 +1,39 @@
+// |reftest| skip -- regexp-duplicate-named-groups is not supported
+// Copyright 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Properties on indices.groups object with duplicate named capture groups
+esid: prod-GroupSpecifier
+features: [regexp-duplicate-named-groups, regexp-match-indices]
+includes: [compareArray.js]
+---*/
+
+const matcher = /(?:(?<x>a)|(?<y>a)(?<x>b))(?:(?<z>c)|(?<z>d))/d;
+
+const threeMatchResult = matcher.exec("abc");
+assert.compareArray(threeMatchResult.indices.groups.x, [1, 2], "group x matches b");
+assert.compareArray(threeMatchResult.indices.groups.y, [0, 1], "group y matches a");
+assert.compareArray(threeMatchResult.indices.groups.z, [2, 3], "group z matches c");
+assert.compareArray(
+ Object.keys(threeMatchResult.indices.groups),
+ ["x", "y", "z"],
+ "Properties of groups are ordered in RegExp source order despite y matching before x in this alternative"
+);
+
+const twoMatchResult = matcher.exec("ad");
+assert.compareArray(twoMatchResult.indices.groups.x, [0, 1], "group x matches a");
+assert.sameValue(twoMatchResult.indices.groups.y, undefined, "group y does not match");
+assert.compareArray(twoMatchResult.indices.groups.z, [1, 2], "group z matches d");
+assert.compareArray(
+ Object.keys(twoMatchResult.indices.groups),
+ ["x", "y", "z"],
+ "y is still present on groups object, in the right order, despite not matching"
+);
+
+const iteratedMatcher = /(?:(?:(?<x>a)|(?<x>b)|c)\k<x>){2}/d;
+
+const matchedInPrevIterationResult = iteratedMatcher.exec("aac");
+assert.sameValue(matchedInPrevIterationResult.indices.groups.x, undefined, "group x does not match in the last iteration");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-g-lastindex-reset.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-g-lastindex-reset.js
new file mode 100644
index 0000000000..8b3dd5e333
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-g-lastindex-reset.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ lastIndex is read and reset to 0 when global is set and the match fails.
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let flags be R.[[OriginalFlags]].
+ 5. If flags contains "g", let global be true, else let global be false.
+ [...]
+ 7. If global is false and sticky is false, let lastIndex be 0.
+ 8. Else, let lastIndex be ? ToLength(? Get(R, "lastIndex")).
+ [...]
+ 12. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Perform ? Set(R, "lastIndex", 0, true).
+ 2. Return null.
+ ii. Let lastIndex be AdvanceStringIndex(S, lastIndex, fullUnicode).
+---*/
+
+var lastIndexReads;
+var result;
+
+var r = /a/g;
+
+function reset(value) {
+ r.lastIndex = {
+ valueOf: function() {
+ lastIndexReads++;
+ return value;
+ }
+ };
+ lastIndexReads = 0;
+}
+
+reset(42); // lastIndex beyond end of string.
+result = r.exec('abc');
+assert.sameValue(result, null);
+assert.sameValue(r.lastIndex, 0);
+assert.sameValue(lastIndexReads, 1);
+
+reset(-1); // No match.
+result = r.exec('nbc');
+assert.sameValue(result, null);
+assert.sameValue(r.lastIndex, 0);
+assert.sameValue(lastIndexReads, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-access.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-access.js
new file mode 100644
index 0000000000..9925767e23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-access.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.
+
+/*---
+description: lastIndex is read but not written when global and sticky are unset.
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ 4. Let lastIndex be ? ToLength(? Get(R, "lastIndex")).
+ [...]
+ 8. If global is false and sticky is false, let lastIndex be 0.
+ [...]
+ 12. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Perform ? Set(R, "lastIndex", 0, true).
+ 2. Return null.
+---*/
+
+var gets = 0;
+var counter = {
+ valueOf: function() {
+ gets++;
+ return 0;
+ }
+};
+
+var r = /a/;
+r.lastIndex = counter;
+
+var result = r.exec('nbc');
+assert.sameValue(result, null);
+assert.sameValue(r.lastIndex, counter);
+assert.sameValue(gets, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-set.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-set.js
new file mode 100644
index 0000000000..f5ff21f355
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/failure-lastindex-set.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2021 Richard Gibson. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ lastIndex is set to 0 after exhausting the string when global and/or sticky are set.
+esid: sec-regexpbuiltinexec
+info: |
+ RegExpBuiltinExec (
+ _R_: an initialized RegExp instance,
+ _S_: a String,
+ )
+ ...
+ 1. Let _length_ be the number of code units in _S_.
+ 2. Let _lastIndex_ be ℝ(? ToLength(? Get(_R_, *"lastIndex"*))).
+ 3. Let _flags_ be _R_.[[OriginalFlags]].
+ 4. If _flags_ contains *"g"*, let _global_ be *true*; else let _global_ be *false*.
+ 5. If _flags_ contains *"y"*, let _sticky_ be *true*; else let _sticky_ be *false*.
+ ...
+ 9. Let _matchSucceeded_ be *false*.
+ 10. Repeat, while _matchSucceeded_ is *false*,
+ a. If _lastIndex_ &gt; _length_, then
+ i. If _global_ is *true* or _sticky_ is *true*, then
+ 1. Perform ? Set(_R_, *"lastIndex"*, *+0*<sub>𝔽</sub>, *true*).
+ ii. Return *null*.
+features: [exponentiation]
+---*/
+
+var R_g = /./g, R_y = /./y, R_gy = /./gy;
+
+var S = "test";
+
+var lastIndex;
+var bigLastIndexes = [
+ Infinity,
+ Number.MAX_VALUE,
+ Number.MAX_SAFE_INTEGER,
+ Number.MAX_SAFE_INTEGER - 1,
+ 2**32 + 4,
+ 2**32 + 3,
+ 2**32 + 2,
+ 2**32 + 1,
+ 2**32,
+ 2**32 - 1,
+ 5
+];
+for ( var i = 0; i < bigLastIndexes.length; i++ ) {
+ lastIndex = bigLastIndexes[i];
+ R_g.lastIndex = lastIndex;
+ R_y.lastIndex = lastIndex;
+ R_gy.lastIndex = lastIndex;
+
+ assert.sameValue(R_g.exec(S), null,
+ "global RegExp instance must fail to match against '" + S +
+ "' at lastIndex " + lastIndex);
+ assert.sameValue(R_y.exec(S), null,
+ "sticky RegExp instance must fail to match against '" + S +
+ "' at lastIndex " + lastIndex);
+ assert.sameValue(R_gy.exec(S), null,
+ "global sticky RegExp instance must fail to match against '" + S +
+ "' at lastIndex " + lastIndex);
+
+ assert.sameValue(R_g.lastIndex, 0,
+ "global RegExp instance lastIndex must be reset after " + lastIndex +
+ " exceeds string length");
+ assert.sameValue(R_y.lastIndex, 0,
+ "sticky RegExp instance lastIndex must be reset after " + lastIndex +
+ " exceeds string length");
+ assert.sameValue(R_gy.lastIndex, 0,
+ "global sticky RegExp instance lastIndex must be reset after " + lastIndex +
+ " exceeds string length");
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/name.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/name.js
new file mode 100644
index 0000000000..89d0243a20
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 21.2.5.2
+description: >
+ RegExp.prototype.exec.name is "exec".
+info: |
+ RegExp.prototype.exec ( string )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(RegExp.prototype.exec.name, "exec");
+
+verifyNotEnumerable(RegExp.prototype.exec, "name");
+verifyNotWritable(RegExp.prototype.exec, "name");
+verifyConfigurable(RegExp.prototype.exec, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/not-a-constructor.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/not-a-constructor.js
new file mode 100644
index 0000000000..c4492952dd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ RegExp.prototype.exec does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(RegExp.prototype.exec),
+ false,
+ 'isConstructor(RegExp.prototype.exec) must return false'
+);
+
+assert.throws(TypeError, () => {
+ let re = new RegExp(''); new re.exec();
+}, '`let re = new RegExp(\'\'); new re.exec()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/shell.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/shell.js
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-g-lastindex-no-access.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-g-lastindex-no-access.js
new file mode 100644
index 0000000000..0642cd4fe8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-g-lastindex-no-access.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.
+
+/*---
+description: lastIndex is accessed when global is set.
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let flags be R.[[OriginalFlags]].
+ 5. If flags contains "g", let global be true, else let global be false.
+ [...]
+ 15. If global is true or sticky is true, then
+ a. Perform ? Set(R, "lastIndex", e, true).
+---*/
+
+var lastIndexReads = 0;
+
+var r = /./g;
+r.lastIndex = {
+ valueOf: function() {
+ lastIndexReads++;
+ return 0;
+ }
+};
+
+var result = r.exec('abc');
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+assert.sameValue(r.lastIndex, 1);
+assert.sameValue(lastIndexReads, 1);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-lastindex-access.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-lastindex-access.js
new file mode 100644
index 0000000000..30f3c62d3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/success-lastindex-access.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.
+
+/*---
+description: lastIndex read but not written when global and sticky are unset.
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ? ToLength(? Get(R, "lastIndex")).
+ 5. Let flags be R.[[OriginalFlags]].
+ 6. If flags contains "g", let global be true, else let global be false.
+ [...]
+ 15. If global is true or sticky is true, then
+ a. Perform ? Set(R, "lastIndex", e, true).
+---*/
+
+var gets = 0;
+var counter = {
+ valueOf: function() {
+ gets++;
+ return 0;
+ }
+};
+
+var r = /./;
+r.lastIndex = counter;
+
+var result = r.exec('abc');
+
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+assert.sameValue(r.lastIndex, counter);
+assert.sameValue(gets, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js
new file mode 100644
index 0000000000..40b419e1c4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Encoding of `capturedValue`
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 12. Let flags be the value of R’s [[OriginalFlags]] internal slot.
+ 13. If flags contains "u", let fullUnicode be true, else let fullUnicode be
+ false.
+ [...]
+ 28. For each integer i such that i > 0 and i ≤ n
+ a. Let captureI be ith element of r's captures List.
+ b. If captureI is undefined, let capturedValue be undefined.
+ c. Else if fullUnicode is true,
+ i. Assert: captureI is a List of code points.
+ ii. Let capturedValue be a string whose code units are the
+ UTF16Encoding (10.1.1) of the code points of captureI.
+ [...]
+ e. Perform CreateDataProperty(A, ToString(i) , capturedValue).
+ 29. Return A.
+---*/
+
+var match = /./u.exec('𝌆');
+
+assert(match !== null);
+assert.sameValue(match.length, 1);
+assert.sameValue(match[0].length, 2);
+assert.sameValue(match[0][0], '\ud834');
+assert.sameValue(match[0][1], '\udf06');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-adv.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-adv.js
new file mode 100644
index 0000000000..405fc8cd43
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-adv.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: Advancement of lastIndex
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 12. Let flags be the value of R’s [[OriginalFlags]] internal slot.
+ 13. If flags contains "u", let fullUnicode be true, else let fullUnicode be
+ false.
+ [...]
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ [...]
+ ii. Let lastIndex be AdvanceStringIndex(S, lastIndex, fullUnicode).
+---*/
+
+assert.sameValue(/\udf06/u.exec('\ud834\udf06'), null);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-value.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-value.js
new file mode 100644
index 0000000000..5c31efb0ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-value.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Definition of `lastIndex` property value
+es6id: 21.2.5.2.2
+info: |
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 12. Let flags be the value of R’s [[OriginalFlags]] internal slot.
+ 13. If flags contains "u", let fullUnicode be true, else let fullUnicode be
+ false.
+ [...]
+ 16. Let e be r's endIndex value.
+ 17. If fullUnicode is true, then
+ a. e is an index into the Input character list, derived from S, matched
+ by matcher. Let eUTF be the smallest index into S that corresponds
+ to the character at element e of Input. If e is greater than or
+ equal to the length of Input, then eUTF is the number of code units
+ in S.
+ b. Let e be eUTF.
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+ b. ReturnIfAbrupt(setStatus).
+---*/
+
+var r = /./ug;
+r.exec('𝌆');
+assert.sameValue(r.lastIndex, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write.js
new file mode 100644
index 0000000000..5c353da177
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Match failure with non-writable `lastIndex` property
+es6id: 21.2.5.2
+info: |
+ 21.2.5.2 RegExp.prototype.exec ( string )
+
+ [...]
+ 6. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ b. Let r be matcher(S, lastIndex).
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Let setStatus be Set(R, "lastIndex", 0, true).
+ 2. ReturnIfAbrupt(setStatus).
+---*/
+
+var r = /c/y;
+Object.defineProperty(r, 'lastIndex', {
+ writable: false
+});
+
+assert.throws(TypeError, function() {
+ r.exec('abc');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex.js
new file mode 100644
index 0000000000..f0da74c13f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-lastindex.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Resets the `lastIndex` property to zero after a match failure
+es6id: 21.2.5.2
+info: |
+ 21.2.5.2 RegExp.prototype.exec ( string )
+
+ [...]
+ 6. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ b. Let r be matcher(S, lastIndex).
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Let setStatus be Set(R, "lastIndex", 0, true).
+---*/
+
+var r = /c/y;
+r.lastIndex = 1;
+
+r.exec('abc');
+
+assert.sameValue(r.lastIndex, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-return.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-return.js
new file mode 100644
index 0000000000..54767c3f16
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-fail-return.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Stops match execution after first match failure
+es6id: 21.2.5.2
+info: |
+ 21.2.5.2 RegExp.prototype.exec ( string )
+
+ [...]
+ 6. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ b. Let r be matcher(S, lastIndex).
+ c. If r is failure, then
+ i. If sticky is true, then
+ [...]
+ 3. Return null.
+---*/
+
+assert.sameValue(/b/y.exec('ab'), null);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-init-lastindex.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-init-lastindex.js
new file mode 100644
index 0000000000..ca5b7ea03b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-init-lastindex.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Honors initial value of the `lastIndex` property
+es6id: 21.2.5.2
+info: |
+ 21.2.5.2 RegExp.prototype.exec ( string )
+
+ [...]
+ 6. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ 9. ReturnIfAbrupt(sticky).
+ 10. If global is false and sticky is false, let lastIndex be 0.
+---*/
+
+var r = /./y;
+var match;
+r.lastIndex = 1;
+
+match = r.exec('abc');
+
+assert(match !== null);
+assert.sameValue(match.length, 1);
+assert.sameValue(match[0], 'b');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-set-lastindex.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-set-lastindex.js
new file mode 100644
index 0000000000..ff58a9aa61
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/y-set-lastindex.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Sets the `lastIndex` property to the end index of the first match
+es6id: 21.2.5.2
+info: |
+ 21.2.5.2 RegExp.prototype.exec ( string )
+
+ [...]
+ 6. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+---*/
+
+var r = /abc/y;
+r.exec('abc');
+
+assert.sameValue(r.lastIndex, 3);
+
+reportCompare(0, 0);