Index: test/webkit/fast/js/regexp-non-capturing-groups.js |
diff --git a/test/webkit/dfg-inline-constant.js b/test/webkit/fast/js/regexp-non-capturing-groups.js |
similarity index 60% |
copy from test/webkit/dfg-inline-constant.js |
copy to test/webkit/fast/js/regexp-non-capturing-groups.js |
index 8c7f7eb63b81646d0c7b1d703cc205d3ffe9b5ad..4d39966349c2f09bdfcf8d7eb3dde7946b03f80d 100644 |
--- a/test/webkit/dfg-inline-constant.js |
+++ b/test/webkit/fast/js/regexp-non-capturing-groups.js |
@@ -22,23 +22,21 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"This tests that function inlining in the DFG JIT doesn't get confused by constants being reused between inliner and inlinee." |
+'Test for behavior of non-capturing groups, as described in <a href="http://blog.stevenlevithan.com/archives/npcg-javascript">' + |
+'a blog post by Steven Levithan</a> and <a href="http://bugs.webkit.org/show_bug.cgi?id=14931">bug 14931</a>.' |
); |
-function foo(a, b) { |
- if (b) |
- return a + 4; |
- return b + 5; |
-} |
- |
-function bar(a, b) { |
- return foo(a, b) + 5; |
-} |
- |
-for (var i = 0; i < 1000; ++i) |
- bar(i, i + 1); |
- |
-shouldBe("bar(6, 0)", "10"); |
-shouldBe("bar(6, 1)", "15"); |
-shouldBe("bar(6, false)", "10"); |
-shouldBe("bar(6, true)", "15"); |
+shouldBe('/(x)?\\1y/.test("y")', 'true'); |
+shouldBe('/(x)?\\1y/.exec("y")', '["y", undefined]'); |
+shouldBe('/(x)?y/.exec("y")', '["y", undefined]'); |
+shouldBe('"y".match(/(x)?\\1y/)', '["y", undefined]'); |
+shouldBe('"y".match(/(x)?y/)', '["y", undefined]'); |
+shouldBe('"y".match(/(x)?\\1y/g)', '["y"]'); |
+shouldBe('"y".split(/(x)?\\1y/)', '["", undefined, ""]'); |
+shouldBe('"y".split(/(x)?y/)', '["", undefined, ""]'); |
+shouldBe('"y".search(/(x)?\\1y/)', '0'); |
+shouldBe('"y".replace(/(x)?\\1y/, "z")', '"z"'); |
+shouldBe('"y".replace(/(x)?y/, "$1")', '""'); |
+shouldBe('"y".replace(/(x)?\\1y/, function($0, $1){ return String($1); })', '"undefined"'); |
+shouldBe('"y".replace(/(x)?y/, function($0, $1){ return String($1); })', '"undefined"'); |
+shouldBe('"y".replace(/(x)?y/, function($0, $1){ return $1; })', '"undefined"'); |