summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js
new file mode 100644
index 0000000000..6b1fe894da
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor-is-undefined.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2018 Peter Wong. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: pending
+description: Throws TypeError if `constructor` property is not an object
+info: |
+ RegExp.prototype [ @@matchAll ] ( string )
+ [...]
+ 3. Return ? MatchAllIterator(R, string).
+
+ MatchAllIterator ( R, O )
+ [...]
+ 2. If ? IsRegExp(R) is true, then
+ a. Let C be ? SpeciesConstructor(R, RegExp).
+
+ SpeciesConstructor ( O, defaultConstructor )
+ [...]
+ 2. Let C be ? Get(O, "constructor").
+ 3. If C is undefined, return defaultConstructor.
+features: [Symbol.matchAll]
+includes: [compareArray.js, compareIterator.js, regExpUtils.js]
+---*/
+
+var regexp = /\w/g;
+regexp.constructor = undefined;
+var str = 'a*b';
+
+assert.compareIterator(regexp[Symbol.matchAll](str), [
+ matchValidator(['a'], 0, str),
+ matchValidator(['b'], 2, str)
+]);
+
+reportCompare(0, 0);