summaryrefslogtreecommitdiff
path: root/test/built-ins/RegExp/prototype/Symbol.match
diff options
context:
space:
mode:
authorMike Pennisi <mike@mikepennisi.com>2015-07-20 10:40:38 -0400
committerMike Pennisi <mike@mikepennisi.com>2015-09-14 17:16:37 -0400
commit62d5787b09a5c2d17630a337b3d830bb0991bef6 (patch)
tree905ae33b480600ff3d68521f639673270767ea4a /test/built-ins/RegExp/prototype/Symbol.match
parentacf2d0cb11659139e6821edc0aa971a160b15562 (diff)
downloadqtdeclarative-testsuites-62d5787b09a5c2d17630a337b3d830bb0991bef6.tar.gz
Add tests for @@match
Introduce tests for the well-known Symbol, `@@match`. This effects the behavior of `String.prototype.match` and is also used by the IsRegExp abstract operation.
Diffstat (limited to 'test/built-ins/RegExp/prototype/Symbol.match')
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-global.js97
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex-err.js34
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex.js33
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-sticky.js79
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-return-val.js36
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err.js40
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex.js39
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-return-val.js35
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err.js42
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex.js38
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-get-global-err.js41
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-get-sticky-err.js37
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.js38
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err.js43
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex.js41
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val-groups.js49
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val.js40
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js51
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err.js36
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex.js33
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/coerce-arg-err.js25
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/coerce-arg.js25
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/coerce-global.js68
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/coerce-sticky.js (renamed from test/built-ins/RegExp/prototype/Symbol.match/get-sticky-coerce.js)10
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/exec-err.js29
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/exec-invocation.js41
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-invalid.js56
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-valid.js34
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-coerce-result-err.js35
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-get-exec-err.js37
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-get-result-err.js35
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err.js22
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex.js20
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js36
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-coerce-lastindex-err.js50
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err.js47
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-match-no-coerce-lastindex.js47
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-match-no-set-lastindex.js43
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-success-return-val.js48
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/g-zero-matches.js21
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/get-exec-err.js30
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/get-global-err.js22
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/length.js25
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/name.js23
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/prop-desc.js18
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/this-val-non-obj.js35
-rw-r--r--test/built-ins/RegExp/prototype/Symbol.match/this-val-non-regexp.js36
47 files changed, 1795 insertions, 5 deletions
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-global.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-global.js
new file mode 100644
index 000000000..86ac657df
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-global.js
@@ -0,0 +1,97 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Type coercion of `global` property value
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 6. Let global be ToBoolean(Get(R, "global")).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var val, result;
+Object.defineProperty(r, 'global', {
+ get: function() {
+ return val;
+ }
+});
+
+val = false;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+
+val = '';
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+
+val = 0;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+
+val = null;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+
+val = undefined;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'a');
+
+val = true;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+assert.sameValue(result[0], 'a');
+assert.sameValue(result[1], 'b');
+
+val = 'truthy';
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+assert.sameValue(result[0], 'a');
+assert.sameValue(result[1], 'b');
+
+val = 86;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+assert.sameValue(result[0], 'a');
+assert.sameValue(result[1], 'b');
+
+val = [];
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+assert.sameValue(result[0], 'a');
+assert.sameValue(result[1], 'b');
+
+val = Symbol.match;
+result = r[Symbol.match]('ab');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+assert.sameValue(result[0], 'a');
+assert.sameValue(result[1], 'b');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex-err.js
new file mode 100644
index 000000000..9b3fd4384
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex-err.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when coercion of `lastIndex` attribute throws an error
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ 5. ReturnIfAbrupt(lastIndex).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+r.lastIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex.js
new file mode 100644
index 000000000..a16b3261e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-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: Type coercion of `lastIndex` property value
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+features: [Symbol.match]
+---*/
+
+var r = /./y;
+var result;
+
+r.lastIndex = '1.9';
+
+result = r[Symbol.match]('abc');
+
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'b');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-sticky.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-sticky.js
new file mode 100644
index 000000000..0f6a28edf
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-coerce-sticky.js
@@ -0,0 +1,79 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Type coercion of `sticky` property value
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. 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).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var val;
+Object.defineProperty(r, 'sticky', {
+ get: function() {
+ return val;
+ }
+});
+
+val = false;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 0, 'literal false');
+
+val = '';
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 0, 'empty string');
+
+val = 0;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 0, 'zero');
+
+val = null;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 0, 'null');
+
+val = undefined;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 0, 'undefined');
+
+val = true;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 1, 'literal true');
+
+r.lastIndex = 0;
+val = 'truthy';
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 1, 'non-empty string');
+
+r.lastIndex = 0;
+val = 86;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 1, 'nonzero number');
+
+r.lastIndex = 0;
+val = [];
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 1, 'array');
+
+r.lastIndex = 0;
+val = Symbol.match;
+r[Symbol.match]('a');
+assert.sameValue(r.lastIndex, 1, 'symbol');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-return-val.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-return-val.js
new file mode 100644
index 000000000..522111520
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-return-val.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return value after a match failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 3. Let length be the number of code units in S.
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ a. If lastIndex > length, then
+ i. Let setStatus be Set(R, "lastIndex", 0, true).
+ ii. ReturnIfAbrupt(setStatus).
+ iii. Return null.
+features: [Symbol.match]
+---*/
+
+var r = /a/;
+
+assert.sameValue(r[Symbol.match]('b'), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err.js
new file mode 100644
index 000000000..4c3261fee
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error thrown while setting `lastIndex` after a match failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 3. Let length be the number of code units in S.
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ a. If lastIndex > length, then
+ i. Let setStatus be Set(R, "lastIndex", 0, true).
+ ii. ReturnIfAbrupt(setStatus).
+ iii. Return null.
+features: [Symbol.match]
+---*/
+
+var r = /a/;
+Object.defineProperty(r, 'lastIndex', { writable: false });
+
+assert.throws(TypeError, function() {
+ r[Symbol.match]('b');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex.js
new file mode 100644
index 000000000..6caa195cb
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Setting `lastIndex` to `0` after a match failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 3. Let length be the number of code units in S.
+ 4. Let lastIndex be ToLength(Get(R,"lastIndex")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ a. If lastIndex > length, then
+ i. Let setStatus be Set(R, "lastIndex", 0, true).
+ ii. ReturnIfAbrupt(setStatus).
+ iii. Return null.
+features: [Symbol.match]
+---*/
+
+var r = /a/;
+r.lastIndex = 3;
+
+r[Symbol.match]('b');
+
+assert.sameValue(r.lastIndex, 0);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-return-val.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-return-val.js
new file mode 100644
index 000000000..b90478d93
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-return-val.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: Return value after a "sticky" match failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Let setStatus be Set(R, "lastIndex", 0, true).
+ 2. ReturnIfAbrupt(setStatus).
+ 3. Return null.
+features: [Symbol.match]
+---*/
+
+assert.sameValue(/a/y[Symbol.match]('ba'), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err.js
new file mode 100644
index 000000000..d7b31cfa9
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error thrown while setting `lastIndex` after a "sticky" match
+ failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Let setStatus be Set(R, "lastIndex", 0, true).
+ 2. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var r = /a/y;
+
+Object.defineProperty(r, 'lastIndex', { writable: false });
+
+assert.throws(TypeError, function() {
+ r[Symbol.match]('ba');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex.js
new file mode 100644
index 000000000..5e0db4984
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex.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: Setting `lastIndex` to `0` after a "sticky" match failure
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ [...]
+ 14. Let matchSucceeded be false.
+ 15. Repeat, while matchSucceeded is false
+ [...]
+ c. If r is failure, then
+ i. If sticky is true, then
+ 1. Let setStatus be Set(R, "lastIndex", 0, true).
+features: [Symbol.match]
+---*/
+
+var r = /a/y;
+r.lastIndex = 1;
+
+r[Symbol.match]('aba');
+
+assert.sameValue(r.lastIndex, 0);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-global-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-global-err.js
new file mode 100644
index 000000000..508560d97
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-global-err.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when error thrown by accessing the `global` property
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 6. Let global be ToBoolean(Get(R, "global")).
+ 7. ReturnIfAbrupt(global).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var callCount = 0;
+Object.defineProperty(r, 'global', {
+ get: function() {
+ callCount += 1;
+
+ if (callCount > 1) {
+ throw new Test262Error();
+ }
+ }
+});
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-sticky-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-sticky-err.js
new file mode 100644
index 000000000..4b1efa9f4
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-get-sticky-err.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when error thrown by accessing the `sticky` property
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 8. Let sticky be ToBoolean(Get(R, "sticky")).
+ 9. ReturnIfAbrupt(sticky).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var shouldThrow = false;
+Object.defineProperty(r, 'sticky', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.js
new file mode 100644
index 000000000..a280e2ea1
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.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: >
+ Extended unicode support is determined by internal slot (not `unicode`
+ property)
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 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.
+features: [Symbol.match]
+---*/
+
+var r;
+
+r = /\udf06/;
+Object.defineProperty(r, 'unicode', { value: true });
+assert.notSameValue(r[Symbol.match]('\ud834\udf06'), null);
+
+r = /\udf06/u;
+Object.defineProperty(r, 'unicode', { value: false });
+assert.sameValue(r[Symbol.match]('\ud834\udf06'), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err.js
new file mode 100644
index 000000000..036eed90e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error thrown while setting `lastIndex` after a "global" match
+ success
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+ b. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var r = /b/;
+var callCount = 0;
+
+Object.defineProperty(r, 'lastIndex', { writable: false });
+Object.defineProperty(r, 'global', {
+ get: function() {
+ callCount += 1;
+ return callCount > 1;
+ }
+});
+
+assert.throws(TypeError, function() {
+ r[Symbol.match]('abc');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex.js
new file mode 100644
index 000000000..9e95de64e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Setting `lastIndex` after a "global" match success
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 16. Let e be r's endIndex value.
+ [...]
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+features: [Symbol.match]
+---*/
+
+var r = /b/;
+var callCount = 0;
+
+Object.defineProperty(r, 'global', {
+ get: function() {
+ callCount += 1;
+ return callCount > 1;
+ }
+});
+
+r[Symbol.match]('abc');
+
+assert.sameValue(r.lastIndex, 2);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val-groups.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val-groups.js
new file mode 100644
index 000000000..5aa858b67
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val-groups.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return value after successful match with capturing groups
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 20. Let A be ArrayCreate(n + 1).
+ [...]
+ 24. Perform CreateDataProperty(A, "index", matchIndex).
+ 25. Perform CreateDataProperty(A, "input", S).
+ 26. Let matchedSubstr be the matched substring (i.e. the portion of S
+ between offset lastIndex inclusive and offset e exclusive).
+ 27. Perform CreateDataProperty(A, "0", matchedSubstr).
+ 28. For each integer i such that i > 0 and i ≤ n
+ [...]
+ d. Else, fullUnicode is false,
+ i. Assert: captureI is a List of code units.
+ ii. Let capturedValue be a string consisting of the code units of
+ captureI.
+ e. Perform CreateDataProperty(A, ToString(i) , capturedValue).
+ [...]
+ 29. Return A.
+features: [Symbol.match]
+---*/
+
+var result = /b(.).(.)./[Symbol.match]('abcdefg');
+
+assert(Array.isArray(result));
+assert.sameValue(result.index, 1);
+assert.sameValue(result.input, 'abcdefg');
+assert.sameValue(result.length, 3);
+assert.sameValue(result[0], 'bcdef');
+assert.sameValue(result[1], 'c');
+assert.sameValue(result[2], 'e');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val.js
new file mode 100644
index 000000000..3c310adf7
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-return-val.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return value after successful match
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 20. Let A be ArrayCreate(n + 1).
+ [...]
+ 24. Perform CreateDataProperty(A, "index", matchIndex).
+ 25. Perform CreateDataProperty(A, "input", S).
+ 26. Let matchedSubstr be the matched substring (i.e. the portion of S
+ between offset lastIndex inclusive and offset e exclusive).
+ 27. Perform CreateDataProperty(A, "0", matchedSubstr).
+ [...]
+ 29. Return A.
+features: [Symbol.match]
+---*/
+
+var result = /b./[Symbol.match]('abcd');
+
+assert(Array.isArray(result));
+assert.sameValue(result.index, 1);
+assert.sameValue(result.input, 'abcd');
+assert.sameValue(result.length, 1);
+assert.sameValue(result[0], 'bc');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js
new file mode 100644
index 000000000..b94f4b08c
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Return value after successful match with extended unicode capturing groups
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 20. Let A be ArrayCreate(n + 1).
+ [...]
+ 24. Perform CreateDataProperty(A, "index", matchIndex).
+ 25. Perform CreateDataProperty(A, "input", S).
+ 26. Let matchedSubstr be the matched substring (i.e. the portion of S
+ between offset lastIndex inclusive and offset e exclusive).
+ 27. Perform CreateDataProperty(A, "0", matchedSubstr).
+ 28. For each integer i such that i > 0 and i ≤ n
+ [...]
+ 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.
+features: [Symbol.match]
+---*/
+
+var result = /b(.).(.)./u[Symbol.match]('ab\ud834\udf06defg');
+
+assert(Array.isArray(result));
+assert.sameValue(result.index, 1);
+assert.sameValue(result.input, 'ab\ud834\udf06defg');
+assert.sameValue(result.length, 3);
+assert.sameValue(result[0], 'b\ud834\udf06def');
+assert.sameValue(result[1], '\ud834\udf06');
+assert.sameValue(result[2], 'e');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err.js
new file mode 100644
index 000000000..0c06c3a4e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error thrown while setting `lastIndex` after a "sticky" match
+ success
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+ b. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var r = /a/y;
+
+Object.defineProperty(r, 'lastIndex', { writable: false });
+
+assert.throws(TypeError, function() {
+ r[Symbol.match]('a');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex.js
new file mode 100644
index 000000000..d0972be11
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-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: Setting `lastIndex` after a "sticky" match success
+es6id: 21.2.5.6
+info: >
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 7. Return RegExpBuiltinExec(R, S).
+
+ 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
+
+ [...]
+ 16. Let e be r's endIndex value.
+ [...]
+ 18. If global is true or sticky is true,
+ a. Let setStatus be Set(R, "lastIndex", e, true).
+features: [Symbol.match]
+---*/
+
+var r = /a/y;
+
+r[Symbol.match]('a');
+
+assert.sameValue(r.lastIndex, 1);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg-err.js b/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg-err.js
new file mode 100644
index 000000000..78f1e885e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg-err.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error thrown during string coercion of first parameter
+es6id: 21.2.5.6
+info: >
+ 21.2.5.6 RegExp.prototype [ @@match ] ( string )
+
+ [...]
+ 3. Let S be ToString(string)
+ 4. ReturnIfAbrupt(S).
+features: [Symbol.match]
+---*/
+
+var str = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ /./[Symbol.match](str);
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg.js b/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg.js
new file mode 100644
index 000000000..0c3202aa2
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/coerce-arg.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: String coercion of first parameter
+es6id: 21.2.5.6
+info: >
+ 21.2.5.6 RegExp.prototype [ @@match ] ( string )
+
+ [...]
+ 3. Let S be ToString(string)
+ [...]
+features: [Symbol.match]
+---*/
+
+var obj = {
+ valueOf: function() {
+ $ERROR('This method should not be invoked.');
+ },
+ toString: function() {
+ return 'toString value';
+ }
+};
+
+assert.notSameValue(/toString value/[Symbol.match](obj), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/coerce-global.js b/test/built-ins/RegExp/prototype/Symbol.match/coerce-global.js
new file mode 100644
index 000000000..ff6658a3c
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/coerce-global.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Boolean coercion of `global` property
+es6id: 21.2.5.6
+info: >
+ 21.2.5.6 RegExp.prototype [ @@match ] ( string )
+
+ [...]
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ [...]
+features: [Symbol.match]
+---*/
+
+var r = /a/;
+var result;
+Object.defineProperty(r, 'global', { writable: true });
+
+r.global = undefined;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = null;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = true;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.notSameValue(result.length, 1);
+
+r.global = false;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = NaN;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = 0;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = '';
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 1);
+
+r.global = 86;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+
+r.global = Symbol.match;
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
+
+r.global = {};
+result = r[Symbol.match]('aa');
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 2);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/get-sticky-coerce.js b/test/built-ins/RegExp/prototype/Symbol.match/coerce-sticky.js
index cf78bb1b5..a17114160 100644
--- a/test/built-ins/RegExp/prototype/Symbol.match/get-sticky-coerce.js
+++ b/test/built-ins/RegExp/prototype/Symbol.match/coerce-sticky.js
@@ -17,7 +17,7 @@ info: >
[...]
8. Let sticky be ToBoolean(Get(R, "sticky")).
-features: [Symbol, Symbol.match]
+features: [Symbol.match]
---*/
var r = /a/;
@@ -41,13 +41,13 @@ assert.notSameValue(r[Symbol.match]('ba'), null);
r.sticky = 0;
assert.notSameValue(r[Symbol.match]('ba'), null);
-r.sticky = 86;
-assert.sameValue(r[Symbol.match]('ba'), null);
-
r.sticky = '';
assert.notSameValue(r[Symbol.match]('ba'), null);
-r.sticky = Symbol();
+r.sticky = 86;
+assert.sameValue(r[Symbol.match]('ba'), null);
+
+r.sticky = Symbol.match;
assert.sameValue(r[Symbol.match]('ba'), null);
r.sticky = {};
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/exec-err.js b/test/built-ins/RegExp/prototype/Symbol.match/exec-err.js
new file mode 100644
index 000000000..cba4d502f
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/exec-err.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when error is thrown by `exec` method
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 5. If IsCallable(exec) is true, then
+ a. Let result be Call(exec, R, «S»).
+ b. ReturnIfAbrupt(result).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+
+r.exec = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/exec-invocation.js b/test/built-ins/RegExp/prototype/Symbol.match/exec-invocation.js
new file mode 100644
index 000000000..06d20f9a1
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/exec-invocation.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invocation of `exec` method
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 5. If IsCallable(exec) is true, then
+ a. Let result be Call(exec, R, «S»).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var callCount = 0;
+var arg = {
+ toString: function() {
+ return 'string form';
+ }
+};
+var thisValue, args;
+
+r.exec = function() {
+ thisValue = this;
+ args = arguments;
+ callCount += 1;
+ return null;
+};
+
+r[Symbol.match](arg);
+
+assert.sameValue(callCount, 1);
+assert.sameValue(thisValue, r);
+assert.sameValue(args.length, 1);
+assert.sameValue(args[0], 'string form');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-invalid.js b/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-invalid.js
new file mode 100644
index 000000000..169f6e91d
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-invalid.js
@@ -0,0 +1,56 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when `exec` method returns value of invalid type
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 5. If IsCallable(exec) is true, then
+ a. Let result be Call(exec, R, «S»).
+ b. ReturnIfAbrupt(result).
+ c. If Type(result) is neither Object or Null, throw a TypeError
+ exception.
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var retValue;
+r.exec = function() {
+ return retValue;
+};
+
+// Explicitly assert the method's presence to avoid false positives (i.e.
+// TypeErrors thrown by invoking an undefined reference).
+assert.sameValue(typeof r[Symbol.match], 'function');
+
+retValue = undefined;
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
+
+retValue = true;
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
+
+retValue = 'string';
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
+
+retValue = Symbol.match;
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
+
+retValue = 86;
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-valid.js b/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-valid.js
new file mode 100644
index 000000000..fd3a02e12
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/exec-return-type-valid.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when `exec` method returns value of valid type
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 5. If IsCallable(exec) is true, then
+ a. Let result be Call(exec, R, «S»).
+ b. ReturnIfAbrupt(result).
+ c. If Type(result) is neither Object or Null, throw a TypeError
+ exception.
+ d. Return result.
+features: [Symbol.match]
+---*/
+
+var r = /./;
+var retValue;
+r.exec = function() {
+ return retValue;
+};
+
+retValue = null;
+assert.sameValue(r[Symbol.match](''), retValue);
+
+retValue = {};
+assert.sameValue(r[Symbol.match](''), retValue);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-coerce-result-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-coerce-result-err.js
new file mode 100644
index 000000000..56571ec32
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-coerce-result-err.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: >
+ Behavior when error is thrown while coercing `0` property of match result
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ 2. ReturnIfAbrupt(matchStr).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+r.exec = function() {
+ return {
+ 0: {
+ toString: function() {
+ throw new Test262Error();
+ }
+ }
+ };
+};
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-get-exec-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-get-exec-err.js
new file mode 100644
index 000000000..8f1f165b5
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-get-exec-err.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when there is an error thrown while accessing the `exec` method of
+ "global" instances
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ ii. ReturnIfAbrupt(result).
+
+ ES6 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 3. Let exec be Get(R, "exec").
+ 4. ReturnIfAbrupt(exec).
+features: [Symbol.match]
+---*/
+
+var r = { global: true };
+Object.defineProperty(r, 'exec', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ RegExp.prototype[Symbol.match].call(r, '');
+});
+
+assert.sameValue(r.lastIndex, 0, 'Error thrown after setting `lastIndex`');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-get-result-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-get-result-err.js
new file mode 100644
index 000000000..dd41d8df7
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-get-result-err.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: >
+ Behavior when error is thrown while accessing `0` property of match result
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ 2. ReturnIfAbrupt(matchStr).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+var poisonedZero = {
+ get 0() {
+ throw new Test262Error();
+ }
+};
+
+r.exec = function() {
+ return poisonedZero;
+};
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err.js
new file mode 100644
index 000000000..e2d99fee1
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when `lastIndex` cannot be set on "global" instances
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ c. Let setStatus be Set(rx, "lastIndex", 0, true).
+ d. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+Object.defineProperty(r, 'lastIndex', { writable: false });
+
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex.js
new file mode 100644
index 000000000..ae7ded3a9
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-init-lastindex.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Initializing the value of `lastIndex` on "global" instances
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ c. Let setStatus be Set(rx, "lastIndex", 0, true).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+
+r.lastIndex = 1;
+
+assert.notSameValue(r[Symbol.match]('a'), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js
new file mode 100644
index 000000000..51467818b
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-advance-lastindex.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ lastIndex is explicitly advanced for zero-length matches for "global"
+ instances
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ [...]
+ 5. If matchStr is the empty String, then
+ [...]
+ c. Let nextIndex be AdvanceStringIndex(S, thisIndex,
+ fullUnicode).
+ d. Let setStatus be Set(rx, "lastIndex", nextIndex, true).
+ e. ReturnIfAbrupt(setStatus).
+ 6. Increment n.
+features: [Symbol.match]
+---*/
+
+var result = /(?:)/g[Symbol.match]('abc');
+
+assert.notSameValue(result, null);
+assert.sameValue(result.length, 4);
+assert.sameValue(result[0], '');
+assert.sameValue(result[1], '');
+assert.sameValue(result[2], '');
+assert.sameValue(result[3], '');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-coerce-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-coerce-lastindex-err.js
new file mode 100644
index 000000000..5ec59caa2
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-coerce-lastindex-err.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error is thrown while type coercing `lastIndex` of zero-width
+ match
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ [...]
+ 5. If matchStr is the empty String, then
+ a. Let thisIndex be ToLength(Get(rx, "lastIndex")).
+ b. ReturnIfAbrupt(thisIndex).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+var nextMatch;
+
+r.exec = function() {
+ var thisMatch = nextMatch;
+ if (thisMatch === null) {
+ return null;
+ }
+ nextMatch = null;
+ return {
+ get 0() {
+ r.lastIndex = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ };
+ return thisMatch;
+ }
+ };
+};
+
+nextMatch = '';
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err.js b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err.js
new file mode 100644
index 000000000..f4fd97754
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error is thrown while setting `lastIndex` after a zero-width
+ match
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ [...]
+ 5. If matchStr is the empty String, then
+ [...]
+ d. Let setStatus be Set(rx, "lastIndex", nextIndex, true).
+ e. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var exec = function() {
+ var thisMatch = nextMatch;
+ if (thisMatch === null) {
+ return null;
+ }
+ nextMatch = null;
+ return {
+ get 0() {
+ Object.defineProperty(r, 'lastIndex', { writable: false });
+ return thisMatch;
+ }
+ };
+};
+var r, nextMatch;
+
+r = /./g;
+r.exec = exec;
+nextMatch = '';
+assert.throws(TypeError, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-coerce-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-coerce-lastindex.js
new file mode 100644
index 000000000..1215eca2c
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-coerce-lastindex.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The `lastIndex` property is not coerced for a non-empty string match
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ [...]
+ 5. If matchStr is the empty String, then
+ a. Let thisIndex be ToLength(Get(rx, "lastIndex")).
+ b. ReturnIfAbrupt(thisIndex).
+features: [Symbol.match]
+---*/
+
+var r = /./g;
+var nextMatch;
+
+r.exec = function() {
+ var thisMatch = nextMatch;
+ if (thisMatch === null) {
+ return null;
+ }
+ nextMatch = null;
+ return {
+ get 0() {
+ r.lastIndex = {
+ valueOf: function() {
+ $ERROR('This function should not be invoked.');
+ }
+ };
+ return thisMatch;
+ }
+ };
+};
+
+nextMatch = 'a non-empty string';
+r[Symbol.match]('');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-set-lastindex.js b/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-set-lastindex.js
new file mode 100644
index 000000000..e2840ab1e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-match-no-set-lastindex.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: The `lastIndex` is not set after a non-zero-width match
+es6id: 21.2.5.6
+info: >
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ [...]
+ iv. Else result is not null,
+ 1. Let matchStr be ToString(Get(result, "0")).
+ [...]
+ 5. If matchStr is the empty String, then
+ [...]
+ d. Let setStatus be Set(rx, "lastIndex", nextIndex, true).
+ e. ReturnIfAbrupt(setStatus).
+features: [Symbol.match]
+---*/
+
+var exec = function() {
+ var thisMatch = nextMatch;
+ if (thisMatch === null) {
+ return null;
+ }
+ nextMatch = null;
+ return {
+ get 0() {
+ Object.defineProperty(r, 'lastIndex', { writable: false });
+ return thisMatch;
+ }
+ };
+};
+var r, nextMatch;
+
+r = /./g;
+r.exec = exec;
+nextMatch = 'a non-empty string';
+r[Symbol.match]('');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-success-return-val.js b/test/built-ins/RegExp/prototype/Symbol.match/g-success-return-val.js
new file mode 100644
index 000000000..da5958ea7
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-success-return-val.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return value when matches occur with the `global` flag
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ e. Let A be ArrayCreate(0).
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ ii. ReturnIfAbrupt(result).
+ iii. If result is null, then
+ 1. If n=0, return null.
+ 2. Else, return A.
+features: [Symbol.match]
+---*/
+
+var result = /.(.)./g[Symbol.match]('abcdefghi');
+
+assert(Array.isArray(result));
+
+assert.sameValue(
+ Object.hasOwnProperty.call(result, 'index'),
+ false,
+ 'Does not define an `index` "own" property'
+);
+assert.sameValue(
+ result.index, undefined, 'Does not define an `index` property'
+);
+assert.sameValue(
+ Object.hasOwnProperty.call(result, 'input'),
+ false,
+ 'Does not define an `input` "own" property'
+);
+assert.sameValue(
+ result.input, undefined, 'Does not define an `input` property'
+);
+
+assert.sameValue(result.length, 3);
+assert.sameValue(result[0], 'abc');
+assert.sameValue(result[1], 'def');
+assert.sameValue(result[2], 'ghi');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/g-zero-matches.js b/test/built-ins/RegExp/prototype/Symbol.match/g-zero-matches.js
new file mode 100644
index 000000000..9d3cf6f8e
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/g-zero-matches.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Return value when no matches occur with the `global` flag
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ [...]
+ 8. Else global is true,
+ [...]
+ g. Repeat,
+ i. Let result be RegExpExec(rx, S).
+ ii. ReturnIfAbrupt(result).
+ iii. If result is null, then
+ 1. If n=0, return null.
+features: [Symbol.match]
+---*/
+
+assert.sameValue(/a/g[Symbol.match]('b'), null);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/get-exec-err.js b/test/built-ins/RegExp/prototype/Symbol.match/get-exec-err.js
new file mode 100644
index 000000000..813667a0f
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/get-exec-err.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when error is thrown while accessing `exec` property
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 3. Let exec be Get(R, "exec").
+ 4. ReturnIfAbrupt(exec).
+features: [Symbol.match]
+---*/
+
+var r = /./;
+
+Object.defineProperty(r, 'exec', {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ r[Symbol.match]('');
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/get-global-err.js b/test/built-ins/RegExp/prototype/Symbol.match/get-global-err.js
new file mode 100644
index 000000000..32866ed63
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/get-global-err.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when error is thrown during retrieval of `global` property
+es6id: 21.2.5.6
+info: >
+ 5. Let global be ToBoolean(Get(rx, "global")).
+ 6. ReturnIfAbrupt(global).
+features: [Symbol.match]
+---*/
+
+var obj = {
+ get global() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ RegExp.prototype[Symbol.match].call(obj);
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/length.js b/test/built-ins/RegExp/prototype/Symbol.match/length.js
new file mode 100644
index 000000000..249d60fc2
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/length.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.5.6
+description: RegExp.prototype[Symbol.match] `length` property
+info: >
+ ES6 Section 17:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this value
+ is equal to the largest number of named arguments shown in the subclause
+ headings for the function description, including optional parameters.
+
+ [...]
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(RegExp.prototype[Symbol.match].length, 1);
+
+verifyNotEnumerable(RegExp.prototype[Symbol.match], 'length');
+verifyNotWritable(RegExp.prototype[Symbol.match], 'length');
+verifyConfigurable(RegExp.prototype[Symbol.match], 'length');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/name.js b/test/built-ins/RegExp/prototype/Symbol.match/name.js
new file mode 100644
index 000000000..d3ceefce2
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/name.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 21.2.5.6
+description: RegExp.prototype[Symbol.match] `name` property
+info: >
+ The value of the name property of this function is "[Symbol.match]".
+
+ ES6 Section 17:
+
+ [...]
+
+ 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[Symbol.match].name, '[Symbol.match]');
+
+verifyNotEnumerable(RegExp.prototype[Symbol.match], 'name');
+verifyNotWritable(RegExp.prototype[Symbol.match], 'name');
+verifyConfigurable(RegExp.prototype[Symbol.match], 'name');
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/prop-desc.js b/test/built-ins/RegExp/prototype/Symbol.match/prop-desc.js
new file mode 100644
index 000000000..63a08e43d
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/prop-desc.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 21.2.5.6
+description: RegExp.prototype[Symbol.match] property descriptor
+info: >
+ ES6 Section 17
+
+ Every other data property described in clauses 18 through 26 and in Annex
+ B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
+ [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(RegExp.prototype, Symbol.match);
+verifyWritable(RegExp.prototype, Symbol.match);
+verifyConfigurable(RegExp.prototype, Symbol.match);
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-obj.js b/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-obj.js
new file mode 100644
index 000000000..79bbba336
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-obj.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: The `this` value must be an object
+es6id: 21.2.5.6
+info: >
+ 1. Let rx be the this value.
+ 2. If Type(rx) is not Object, throw a TypeError exception.
+features: [Symbol.match]
+---*/
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(undefined);
+});
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(null);
+});
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(true);
+});
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call('string');
+});
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(Symbol.match);
+});
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(86);
+});
diff --git a/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-regexp.js b/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-regexp.js
new file mode 100644
index 000000000..567fa5931
--- /dev/null
+++ b/test/built-ins/RegExp/prototype/Symbol.match/this-val-non-regexp.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Behavior when invoked on an object without a a [[RegExpMatcher]] internal
+ slot
+es6id: 21.2.5.6
+info: >
+ [...]
+ 7. If global is false, then
+ a. Return RegExpExec(rx, S).
+
+ 21.2.5.2.1 Runtime Semantics: RegExpExec ( R, S )
+
+ [...]
+ 5. If IsCallable(exec) is true, then
+ [...]
+ d. Return result.
+ 6. If R does not have a [[RegExpMatcher]] internal slot, throw a TypeError
+ exception.
+features: [Symbol.match]
+---*/
+
+var objWithExec = {
+ exec: function() {
+ return null;
+ }
+};
+var objWithoutExec = {};
+
+RegExp.prototype[Symbol.match].call(objWithExec);
+
+assert.throws(TypeError, function() {
+ RegExp.prototype[Symbol.match].call(objWithoutExec);
+});