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

Unified Diff: test/webkit/fast/regex/ecma-regex-examples.js

Issue 20280003: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
Index: test/webkit/fast/regex/ecma-regex-examples.js
diff --git a/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js b/test/webkit/fast/regex/ecma-regex-examples.js
similarity index 55%
copy from test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
copy to test/webkit/fast/regex/ecma-regex-examples.js
index 9866126ef09bafb7ca15f1b9a595ecb5f96a6215..70ecb6bc219eba92f50c53ea48f8e48952230cdd 100644
--- a/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
+++ b/test/webkit/fast/regex/ecma-regex-examples.js
@@ -22,49 +22,41 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"This tests that a patchable GetById right after a watchpoint has the appropriate nop padding."
+"This page tests the regex examples from the ECMA-262 specification."
);
-function foo(o, p) {
- var a = p.f;
- var b = o.f; // Watchpoint.
- var c = p.g; // Patchable GetById.
- return b(a + c);
-}
+var regex01 = /a|ab/;
+shouldBe('regex01.exec("abc")', '["a"]');
-function O() {
-}
+var regex02 = /((a)|(ab))((c)|(bc))/;
+shouldBe('regex02.exec("abc")', '["abc", "a", "a", undefined, "bc", undefined, "bc"]');
-O.prototype.f = function(x) { return x + 1; };
+var regex03 = /a[a-z]{2,4}/;
+shouldBe('regex03.exec("abcdefghi")', '["abcde"]');
-var o = new O();
+var regex04 = /a[a-z]{2,4}?/;
+shouldBe('regex04.exec("abcdefghi")', '["abc"]');
-function P1() {
-}
+var regex05 = /(aa|aabaac|ba|b|c)*/;
+shouldBe('regex05.exec("aabaac")', '["aaba", "ba"]');
-P1.prototype.g = 42;
+var regex06 = /^(a+)\1*,\1+$/;
+shouldBe('"aaaaaaaaaa,aaaaaaaaaaaaaaa".replace(regex06,"$1")', '"aaaaa"');
-function P2() {
-}
+var regex07 = /(z)((a+)?(b+)?(c))*/;
+shouldBe('regex07.exec("zaacbbbcac")', '["zaacbbbcac", "z", "ac", "a", undefined, "c"]');
-P2.prototype.g = 24;
+var regex08 = /(a*)*/;
+shouldBe('regex08.exec("b")', '["", undefined]');
-var p1 = new P1();
-var p2 = new P2();
+var regex09 = /(a*)b\1+/;
+shouldBe('regex09.exec("baaaac")', '["b", ""]');
-p1.f = 1;
-p2.f = 2;
+var regex10 = /(?=(a+))/;
+shouldBe('regex10.exec("baaabac")', '["", "aaa"]');
-for (var i = 0; i < 200; ++i) {
- var p = (i % 2) ? p1 : p2;
- var expected = (i % 2) ? 44 : 27;
- if (i == 150) {
- // Cause first the watchpoint on o.f to fire, and then the GetById
- // to be reset.
- O.prototype.g = 57; // Fire the watchpoint.
- P1.prototype.h = 58; // Reset the GetById.
- P2.prototype.h = 59; // Not necessary, but what the heck - this resets the GetById even more.
- }
- shouldBe("foo(o, p)", "" + expected);
-}
+var regex11 = /(?=(a+))a*b\1/;
+shouldBe('regex11.exec("baaabac")', '["aba", "a"]');
+var regex12 = /(.*?)a(?!(a+)b\2c)\2(.*)/;
+shouldBe('regex12.exec("baaabaac")', '["baaabaac", "ba", undefined, "abaac"]');
« no previous file with comments | « test/webkit/fast/regex/early-acid3-86-expected.txt ('k') | test/webkit/fast/regex/ecma-regex-examples-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698