mirror of https://github.com/tc39/test262.git
assert calls order for Symbol.match on matchAll usage (#1795)
Fix #1794
This commit is contained in:
parent
37190a1deb
commit
d544eacedf
|
@ -25,16 +25,32 @@ Object.defineProperty(RegExp.prototype, Symbol.match, {
|
|||
}
|
||||
});
|
||||
|
||||
var count = 0;
|
||||
var calls = [];
|
||||
var o = {
|
||||
get [Symbol.match]() {
|
||||
++count;
|
||||
calls.push('get @@match');
|
||||
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(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');
|
||||
|
|
Loading…
Reference in New Issue