Skip to content
Snippets Groups Projects
Unverified Commit d544eace authored by Leo Balter's avatar Leo Balter Committed by GitHub
Browse files

assert calls order for Symbol.match on matchAll usage (#1795)

Fix #1794
parent 37190a1d
No related branches found
No related tags found
No related merge requests found
...@@ -25,16 +25,32 @@ Object.defineProperty(RegExp.prototype, Symbol.match, { ...@@ -25,16 +25,32 @@ Object.defineProperty(RegExp.prototype, Symbol.match, {
} }
}); });
var count = 0; var calls = [];
var o = { var o = {
get [Symbol.match]() { get [Symbol.match]() {
++count; calls.push('get @@match');
return false; return false;
}, },
flags: "", get flags() {
calls.push('get flags');
return {
toString() {
calls.push('flags toString');
}
};
},
}; };
RegExp.prototype[Symbol.matchAll].call(o, '1'); RegExp.prototype[Symbol.matchAll].call(o, {
toString() {
calls.push('arg toString')
}
});
assert.sameValue(0, internalCount); assert.sameValue(0, internalCount);
assert.sameValue(1, count);
assert.sameValue(calls.length, 4);
assert.sameValue(calls[0], 'get @@match');
assert.sameValue(calls[1], 'arg toString');
assert.sameValue(calls[2], 'get flags');
assert.sameValue(calls[3], 'flags toString');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment