diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-2438.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-2438.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-2438.js b/deps/v8/test/mjsunit/regress/regress-2438.js index f694ff8e19..51092788ac 100644 --- a/deps/v8/test/mjsunit/regress/regress-2438.js +++ b/deps/v8/test/mjsunit/regress/regress-2438.js @@ -27,14 +27,20 @@ function testSideEffects(subject, re) { var counter = 0; + var expected_counter = 0; + const accesses_lastindex = (re.global || re.sticky); var side_effect_object = { valueOf: function() { return counter++; } }; re.lastIndex = side_effect_object; re.exec(subject); - assertEquals(1, counter); + + if (accesses_lastindex) expected_counter++; + assertEquals(expected_counter, counter); re.lastIndex = side_effect_object; re.test(subject); - assertEquals(2, counter); + + if (accesses_lastindex) expected_counter++; + assertEquals(expected_counter, counter); } testSideEffects("zzzz", /a/); |