Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1232)

Unified Diff: test/mjsunit/regress/regress-2437.js

Issue 2339443002: [regexp] Avoid unneeded accesses to lastIndex (Closed)
Patch Set: Update test262 status Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/regexp.js ('k') | test/mjsunit/regress/regress-2438.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2437.js
diff --git a/test/mjsunit/regress/regress-2437.js b/test/mjsunit/regress/regress-2437.js
index c82293ae3252872c6873b2c0025934eb7d101e98..66f0abfef582503751c6ad0164de26fc295aa8a9 100644
--- a/test/mjsunit/regress/regress-2437.js
+++ b/test/mjsunit/regress/regress-2437.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Summary of the spec: lastIndex is reset to 0 if
-// - a regexp fails to match, regardless of global or non-global.
+// - a global or sticky regexp fails to match.
// - a global regexp is used in a function that returns multiple results,
// such as String.prototype.replace or String.prototype.match, since it
// repeats the regexp until it fails to match.
@@ -37,19 +37,19 @@
r = /a/;
r.lastIndex = 1;
r.exec("zzzz");
-assertEquals(0, r.lastIndex);
+assertEquals(1, r.lastIndex);
// Test Regexp.prototype.test
r = /a/;
r.lastIndex = 1;
r.test("zzzz");
-assertEquals(0, r.lastIndex);
+assertEquals(1, r.lastIndex);
// Test String.prototype.match
r = /a/;
r.lastIndex = 1;
"zzzz".match(r);
-assertEquals(0, r.lastIndex);
+assertEquals(1, r.lastIndex);
// Test String.prototype.replace with atomic regexp and empty string.
r = /a/;
@@ -116,7 +116,7 @@ assertEquals(-1, r.lastIndex);
r.lastIndex = -1;
"01234567".match(r);
-assertEquals(0, r.lastIndex);
+assertEquals(-1, r.lastIndex);
// Also test RegExp.prototype.exec and RegExp.prototype.test
r = /a/g;
@@ -131,7 +131,7 @@ assertEquals(5, r.lastIndex);
r = /a/;
r.lastIndex = 1;
r.exec("01234567");
-assertEquals(0, r.lastIndex);
+assertEquals(1, r.lastIndex);
r.lastIndex = 1;
r.exec("0123abcd");
@@ -149,7 +149,7 @@ assertEquals(5, r.lastIndex);
r = /a/;
r.lastIndex = 1;
r.test("01234567");
-assertEquals(0, r.lastIndex);
+assertEquals(1, r.lastIndex);
r.lastIndex = 1;
r.test("0123abcd");
« no previous file with comments | « test/mjsunit/regexp.js ('k') | test/mjsunit/regress/regress-2438.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698