[matchAll] pass a global regex (#2399)

- also, expect the right kind of error in `flags-undefined-throws.js`

Fixes #2398
This commit is contained in:
Jordan Harband 2019-10-09 07:32:39 -07:00 committed by Leo Balter
parent d49777de27
commit 59d1af9d2a
7 changed files with 7 additions and 7 deletions

View File

@ -28,6 +28,6 @@ Object.defineProperty(RegExp.prototype, 'flags', {
} }
}); });
assert.throws(Test262Error, function () { assert.throws(TypeError, function () {
''.matchAll(/a/g); ''.matchAll(/a/g);
}); });

View File

@ -13,7 +13,7 @@ info: |
features: [Symbol.matchAll, String.prototype.matchAll] features: [Symbol.matchAll, String.prototype.matchAll]
---*/ ---*/
var regexp = /./; var regexp = /./g;
Object.defineProperty(regexp, Symbol.matchAll, { Object.defineProperty(regexp, Symbol.matchAll, {
get() { get() {
throw new Test262Error(); throw new Test262Error();

View File

@ -16,7 +16,7 @@ info: |
features: [Symbol.matchAll, String.prototype.matchAll] features: [Symbol.matchAll, String.prototype.matchAll]
---*/ ---*/
var regexp = /./; var regexp = /./g;
var callCount = 0; var callCount = 0;
var arg; var arg;
var obj = {}; var obj = {};

View File

@ -11,7 +11,7 @@ info: |
features: [Symbol.matchAll, String.prototype.matchAll] features: [Symbol.matchAll, String.prototype.matchAll]
---*/ ---*/
var regexp = /./; var regexp = /./g;
regexp[Symbol.matchAll] = function() { regexp[Symbol.matchAll] = function() {
throw new Test262Error(); throw new Test262Error();
}; };

View File

@ -18,5 +18,5 @@ Object.defineProperty(RegExp.prototype, Symbol.matchAll, {
}); });
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
''.matchAll(/./); ''.matchAll(/./g);
}); });

View File

@ -25,7 +25,7 @@ RegExp.prototype[Symbol.matchAll] = function() {
return returnVal; return returnVal;
}; };
var regexp = /./; var regexp = /./g;
var str = ''; var str = '';
assert.sameValue(str.matchAll(regexp), returnVal); assert.sameValue(str.matchAll(regexp), returnVal);

View File

@ -18,5 +18,5 @@ RegExp.prototype[Symbol.matchAll] = function() {
}; };
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
''.matchAll(/./); ''.matchAll(/./g);
}); });