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

Side by Side Diff: test/mjsunit/harmony/unicode-regexp-backrefs.js

Issue 2096933002: Remove all harmony runtime flags which shipped in M51 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-unicode-regexps --harmony-regexp-lookbehind
6
7 // Back reference does not end in the middle of a surrogate pair.
8 function replace(string) {
9 return string.replace(/L/g, "\ud800")
10 .replace(/l/g, "\ud801")
11 .replace(/T/g, "\udc00")
12 .replace(/\./g, "[^]");
13 }
14
15 function test(expectation, regexp_source, subject) {
16 if (expectation !== null) expectation = expectation.map(replace);
17 subject = replace(subject);
18 regexp_source = replace(regexp_source);
19 assertEquals(expectation, new RegExp(regexp_source, "u").exec(subject));
20 }
21
22 // Back reference does not end in the middle of a surrogate pair.
23 test(null, "(L)\\1", "LLT");
24 test(["LLTLl", "L", "l"], "(L).*\\1(.)", "LLTLl");
25 test(null, "(aL).*\\1", "aLaLT");
26 test(["aLaLTaLl", "aL", "l"], "(aL).*\\1(.)", "aLaLTaLl");
27
28 var s = "TabcLxLTabcLxTabcLTyTabcLz";
29 test([s, "TabcL", "z"], "([^x]+).*\\1(.)", s);
30
31 // Back reference does not start in the middle of a surrogate pair.
32 test(["TLTabTc", "T", "c"], "(T).*\\1(.)", "TLTabTc");
33
34 // Lookbehinds.
35 test(null, "(?<=\\1(T)x)", "LTTx");
36 test(["", "b", "T"], "(?<=(.)\\2.*(T)x)", "bTaLTTx");
37 test(null, "(?<=\\1.*(L)x)", "LTLx");
38 test(["", "b", "L"], "(?<=(.)\\2.*(L)x)", "bLaLTLx");
39
40
41 test(null, "([^x]+)x*\\1", "LxLT");
42 test(null, "([^x]+)x*\\1", "TxLT");
43 test(null, "([^x]+)x*\\1", "LTxL");
44 test(null, "([^x]+)x*\\1", "LTxT");
45 test(null, "([^x]+)x*\\1", "xLxLT");
46 test(null, "([^x]+)x*\\1", "xTxLT");
47 test(null, "([^x]+)x*\\1", "xLTxL");
48 test(null, "([^x]+)x*\\1", "xLTxT");
49 test(null, "([^x]+)x*\\1", "xxxLxxLTxx");
50 test(null, "([^x]+)x*\\1", "xxxTxxLTxx");
51 test(null, "([^x]+)x*\\1", "xxxLTxxLxx");
52 test(null, "([^x]+)x*\\1", "xxxLTxxTxx");
53 test(["LTTxxLTT", "LTT"], "([^x]+)x*\\1", "xxxLTTxxLTTxx");
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/unicode-escapes-in-regexps.js ('k') | test/mjsunit/harmony/unicode-regexp-ignore-case.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698