diff --git a/test/built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once.js b/test/built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once.js index b74b19181c..7281af422f 100644 --- a/test/built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once.js +++ b/test/built-ins/RegExp/prototype/Symbol.matchAll/isregexp-called-once.js @@ -5,16 +5,15 @@ esid: pending description: IsRegExp should only be called once info: | RegExp.prototype [ @@matchAll ] ( string ) + 1. Let R be the this value. [...] - 3. Return ? MatchAllIterator(R, string). + 4. Let C be ? SpeciesConstructor(R, %RegExp%). + 5. Let flags be ? ToString(? Get(R, "flags")). + 6. Let matcher be ? Construct(C, « R, flags »). - MatchAllIterator ( R, O ) + 21.2.3.1 RegExp ( pattern, flags ) + 1. Let patternIsRegExp be ? IsRegExp(pattern). [...] - 2. If ? IsRegExp(R) is true, then - [...] - 3. Else, - a. Let flags be "g". - b. Let matcher be ? RegExpCreate(R, flags). features: [Symbol.match, Symbol.matchAll] ---*/ @@ -31,7 +30,8 @@ var o = { get [Symbol.match]() { ++count; return false; - } + }, + flags: "", }; RegExp.prototype[Symbol.matchAll].call(o, '1'); diff --git a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor.js b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor.js index cb9e9bf03c..3dc4048ae3 100644 --- a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor.js +++ b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-constructor.js @@ -6,14 +6,13 @@ description: Custom species constructor is called when creating internal RegExp info: | RegExp.prototype [ @@matchAll ] ( string ) [...] - 3. Return ? MatchAllIterator(R, string). - - MatchAllIterator ( R, O ) + 4. Let C be ? SpeciesConstructor(R, %RegExp%). + 5. Let flags be ? ToString(? Get(R, "flags")). + 6. Let matcher be ? Construct(C, « R, flags »). + [...] + 9. If flags contains "g", let global be true. + 10. Else, let global be false. [...] - 2. If ? IsRegExp(R) is true, then - a. Let C be ? SpeciesConstructor(R, RegExp). - b. Let flags be ? ToString(? Get(R, "flags")) - c. Let matcher be ? Construct(C, R, flags). features: [Symbol.matchAll, Symbol.species] includes: [compareArray.js, compareIterator.js, regExpUtils.js] ---*/ @@ -38,5 +37,4 @@ assert.sameValue(callArgs[1], 'u'); assert.compareIterator(iter, [ matchValidator(['a'], 0, str), - matchValidator(['b'], 2, str) ]); diff --git a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws.js b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws.js index 46304cc84a..a22120f0fd 100644 --- a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws.js +++ b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-global-throws.js @@ -3,18 +3,17 @@ /*--- esid: pending description: | - Re-throws errors thrown while accessing species constructed RegExp's - global property + Doesn't access the "global" property of the constructed RegExp info: | RegExp.prototype [ @@matchAll ] ( string ) [...] - 3. Return ? MatchAllIterator(R, string). - - MatchAllIterator ( R, O ) + 4. Let C be ? SpeciesConstructor(R, %RegExp%). + 5. Let flags be ? ToString(? Get(R, "flags")). + 6. Let matcher be ? Construct(C, « R, flags »). + [...] + 9. If flags contains "g", let global be true. + 10. Else, let global be false. [...] - 2. If ? IsRegExp(R) is true, then - [...] - d. Let global be ? ToBoolean(? Get(matcher, "global")). features: [Symbol.matchAll, Symbol.species] ---*/ @@ -29,6 +28,4 @@ regexp.constructor = { } }; -assert.throws(Test262Error, function() { - regexp[Symbol.matchAll](''); -}); +regexp[Symbol.matchAll](''); diff --git a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws.js b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws.js index 931b028995..84c880aaa4 100644 --- a/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws.js +++ b/test/built-ins/RegExp/prototype/Symbol.matchAll/species-regexp-get-unicode-throws.js @@ -3,18 +3,17 @@ /*--- esid: pending description: | - Re-throws errors thrown while accessing species constructed RegExp's - unicode property + Doesn't access the "unicode" property of the constructed RegExp info: | RegExp.prototype [ @@matchAll ] ( string ) [...] - 3. Return ? MatchAllIterator(R, string). - - MatchAllIterator ( R, O ) + 4. Let C be ? SpeciesConstructor(R, %RegExp%). + 5. Let flags be ? ToString(? Get(R, "flags")). + 6. Let matcher be ? Construct(C, « R, flags »). + [...] + 11. If flags contains "u", let fullUnicode be true. + 12. Else, let fullUnicode be false. [...] - 2. If ? IsRegExp(R) is true, then - [...] - e. Let fullUnicode be ? ToBoolean(? Get(matcher, "unicode")). features: [Symbol.matchAll, Symbol.species] ---*/ @@ -29,6 +28,4 @@ regexp.constructor = { } }; -assert.throws(Test262Error, function() { - regexp[Symbol.matchAll](''); -}); +regexp[Symbol.matchAll](''); diff --git a/test/built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll.js b/test/built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll.js index 0aeb021a9e..1c97f88511 100644 --- a/test/built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll.js +++ b/test/built-ins/String/prototype/matchAll/regexp-prototype-has-no-matchAll.js @@ -10,15 +10,26 @@ info: | a. Let matcher be ? GetMethod(regexp, @@matchAll). b. If matcher is not undefined, then [...] - 3. Return ? MatchAllIterator(regexp, O). + [...] + 4. Let matcher be ? RegExpCreate(R, "g"). + [...] + + 21.2.3.2.3 Runtime Semantics: RegExpCreate ( P, F ) + [...] + 2. Return ? RegExpInitialize(obj, P, F). + + 21.2.3.2.2 Runtime Semantics: RegExpInitialize ( obj, pattern, flags ) + 1. If pattern is undefined, let P be the empty String. + 2. Else, let P be ? ToString(pattern). + [...] features: [Symbol.matchAll, String.prototype.matchAll] includes: [compareArray.js, compareIterator.js, regExpUtils.js] ---*/ delete RegExp.prototype[Symbol.matchAll]; -var str = 'a*b'; +var str = '/a/g*/b/g'; assert.compareIterator(str.matchAll(/\w/g), [ - matchValidator(['a'], 0, str), - matchValidator(['b'], 2, str) + matchValidator(['/a/g'], 0, str), + matchValidator(['/b/g'], 5, str) ]);