From d544eacedfc088ab334a6cbc811fbe55a01e28a7 Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Wed, 26 Sep 2018 11:37:19 -0400 Subject: [PATCH] assert calls order for Symbol.match on matchAll usage (#1795) Fix #1794 --- .../Symbol.matchAll/isregexp-called-once.js | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) 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 7281af422f..c3b3e173b3 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 @@ -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'); -- GitLab