summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js
new file mode 100644
index 0000000000..f7a03a6c56
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/string-tostring.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 Peter Wong. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: String coercion of `string` argument
+info: |
+ RegExp.prototype [ @@matchAll ] ( string )
+ [...]
+ 3. Return ? MatchAllIterator(R, string).
+
+ MatchAllIterator ( R, O )
+ 1. Let S be ? ToString(O).
+features: [Symbol.matchAll]
+includes: [compareArray.js, compareIterator.js, regExpUtils.js]
+---*/
+
+var str = 'a*b';
+var obj = {
+ toString() {
+ return str;
+ }
+};
+var regexp = /\w/g;
+
+assert.compareIterator(regexp[Symbol.matchAll](obj), [
+ matchValidator(['a'], 0, str),
+ matchValidator(['b'], 2, str)
+]);
+
+
+reportCompare(0, 0);