| OLD | NEW |
| (Empty) |
| 1 description( | |
| 2 'Test for behavior of non-capturing groups, as described in <a href="http://blog
.stevenlevithan.com/archives/npcg-javascript">' + | |
| 3 'a blog post by Steven Levithan</a> and <a href="http://bugs.webkit.org/show_bug
.cgi?id=14931">bug 14931</a>.' | |
| 4 ); | |
| 5 | |
| 6 shouldBe('/(x)?\\1y/.test("y")', 'true'); | |
| 7 shouldBe('/(x)?\\1y/.exec("y")', '["y", undefined]'); | |
| 8 shouldBe('/(x)?y/.exec("y")', '["y", undefined]'); | |
| 9 shouldBe('"y".match(/(x)?\\1y/)', '["y", undefined]'); | |
| 10 shouldBe('"y".match(/(x)?y/)', '["y", undefined]'); | |
| 11 shouldBe('"y".match(/(x)?\\1y/g)', '["y"]'); | |
| 12 shouldBe('"y".split(/(x)?\\1y/)', '["", undefined, ""]'); | |
| 13 shouldBe('"y".split(/(x)?y/)', '["", undefined, ""]'); | |
| 14 shouldBe('"y".search(/(x)?\\1y/)', '0'); | |
| 15 shouldBe('"y".replace(/(x)?\\1y/, "z")', '"z"'); | |
| 16 shouldBe('"y".replace(/(x)?y/, "$1")', '""'); | |
| 17 shouldBe('"y".replace(/(x)?\\1y/, function($0, $1){ return String($1); })', '"un
defined"'); | |
| 18 shouldBe('"y".replace(/(x)?y/, function($0, $1){ return String($1); })', '"undef
ined"'); | |
| 19 shouldBe('"y".replace(/(x)?y/, function($0, $1){ return $1; })', '"undefined"'); | |
| OLD | NEW |