Author: [email protected]
Date: Wed Mar 11 02:29:29 2009
New Revision: 1485

Modified:
    branches/bleeding_edge/test/mjsunit/regexp-static.js

Log:
Add a test that r1383 failed (harmlessly).
Review URL: http://codereview.chromium.org/44002

Modified: branches/bleeding_edge/test/mjsunit/regexp-static.js
==============================================================================
--- branches/bleeding_edge/test/mjsunit/regexp-static.js        (original)
+++ branches/bleeding_edge/test/mjsunit/regexp-static.js        Wed Mar 11  
02:29:29 2009
@@ -132,3 +132,25 @@
  re = /(.)/g;
  function f() { return RegExp.$1; };
  assertEquals('abcd', 'abcd'.replace(re, f));
+
+// lastParen where the last parenthesis didn't match.
+assertEquals("foo,", /foo(?:a(x))?/.exec("foobx"), "lastParen setup");
+assertEquals("", RegExp.lastParen, "lastParen");
+
+// The same test for $1 to $9.
+for (var i = 1; i <= 9; i++) {
+  var haystack = "foo";
+  var re_text = "^foo";
+  for (var j = 0; j < i - 1; j++) {
+    haystack += "x";
+    re_text += "(x)";
+  }
+  re_text += "(?:a(x))?";
+  haystack += "bx";
+  var re = new RegExp(re_text);
+  assertTrue(re.test(haystack), "$" + i + " setup");
+  for (var j = 1; j < i - 1; j++) {
+    assertEquals("x", RegExp['$' + j], "$" + j + " in $" + i + " setup");
+  }
+  assertEquals("", RegExp['$' + (i)], "$" + i);
+}

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to