Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests for String.prototype.matchAll #1587

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: pending
description: Throws TypeError when internally created RegExp's @@match is false
description: IsRegExp should only be called once
info: |
RegExp.prototype [ @@matchAll ] ( string )
[...]
Expand All @@ -13,17 +13,28 @@ info: |
2. If ? IsRegExp(R) is true, then
[...]
3. Else,
a. Let matcher be RegExpCreate(R, "g").
b. If ? IsRegExp(matcher) is not true, throw a TypeError exception.
a. Let flags be "g".
b. Let matcher be ? RegExpCreate(R, flags).
features: [Symbol.match, Symbol.matchAll]
---*/

var internalCount = 0;
Object.defineProperty(RegExp.prototype, Symbol.match, {
get() {
return false;
get: function() {
++internalCount;
return true;
}
});

assert.throws(TypeError, function() {
RegExp.prototype[Symbol.matchAll].call({}, '');
});
var count = 0;
var o = {
get [Symbol.match]() {
++count;
return false;
}
};

RegExp.prototype[Symbol.matchAll].call(o, '1');

assert.sameValue(0, internalCount);
assert.sameValue(1, count);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ info: |
2. If ? IsRegExp(R) is true, then
[...]
3. Else,
a. Let R be RegExpCreate(R, "g").
a. Let flags be "g".
b. Let matcher be ? RegExpCreate(R, flags).
features: [Symbol.matchAll]
---*/

Expand Down
2 changes: 1 addition & 1 deletion test/built-ins/Symbol/matchAll/prop-desc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
features: [Symbol.match]
features: [Symbol.matchAll]
---*/

assert.sameValue(typeof Symbol.matchAll, 'symbol');
Expand Down