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

Side by Side Diff: test/mjsunit/harmony/unicode-character-ranges.js

Issue 1681873002: [regexp] fix off-by-one in UnicodeRangeSplitter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-unicode-regexps --harmony-regexp-lookbehind 5 // Flags: --harmony-unicode-regexps --harmony-regexp-lookbehind
6 6
7 function execl(expectation, regexp, subject) { 7 function execl(expectation, regexp, subject) {
8 if (regexp instanceof String) regexp = new RegExp(regexp, "u"); 8 if (regexp instanceof String) regexp = new RegExp(regexp, "u");
9 assertEquals(expectation, regexp.exec(subject)); 9 assertEquals(expectation, regexp.exec(subject));
10 } 10 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 execl(["\ud800X"], /.X/u, "\ud800XaX"); 90 execl(["\ud800X"], /.X/u, "\ud800XaX");
91 execl(["aX"], /.(?<!\ud800)X/u, "\ud800XaX"); 91 execl(["aX"], /.(?<!\ud800)X/u, "\ud800XaX");
92 execl(["aX"], /.(?<![\ud800-\ud900])X/u, "\ud800XaX"); 92 execl(["aX"], /.(?<![\ud800-\ud900])X/u, "\ud800XaX");
93 93
94 execl(null, /[]/u, "\u1234"); 94 execl(null, /[]/u, "\u1234");
95 execl(["0abc"], /[^]abc/u, "0abc"); 95 execl(["0abc"], /[^]abc/u, "0abc");
96 execl(["\u1234abc"], /[^]abc/u, "\u1234abc"); 96 execl(["\u1234abc"], /[^]abc/u, "\u1234abc");
97 execl(["\u{12345}abc"], /[^]abc/u, "\u{12345}abc"); 97 execl(["\u{12345}abc"], /[^]abc/u, "\u{12345}abc");
98 98
99 execl(null, /[\u{0}-\u{1F444}]/u, "\ud83d\udfff");
100
99 // Backward matches of lone surrogates. 101 // Backward matches of lone surrogates.
100 execl(["B", "\ud803A"], /(?<=([\ud800-\ud900]A))B/u, 102 execl(["B", "\ud803A"], /(?<=([\ud800-\ud900]A))B/u,
101 "\ud801\udc00AB\udc00AB\ud802\ud803AB"); 103 "\ud801\udc00AB\udc00AB\ud802\ud803AB");
102 execl(["B", "\udc00A"], /(?<=([\ud800-\u{10300}]A))B/u, 104 execl(["B", "\udc00A"], /(?<=([\ud800-\u{10300}]A))B/u,
103 "\ud801\udc00AB\udc00AB\ud802\ud803AB"); 105 "\ud801\udc00AB\udc00AB\ud802\ud803AB");
104 execl(["B", "\udc11A"], /(?<=([\udc00-\udd00]A))B/u, 106 execl(["B", "\udc11A"], /(?<=([\udc00-\udd00]A))B/u,
105 "\ud801\udc00AB\udc11AB\ud802\ud803AB"); 107 "\ud801\udc00AB\udc11AB\ud802\ud803AB");
106 execl(["X", "\ud800C"], /(?<=(\ud800\w))X/u, 108 execl(["X", "\ud800C"], /(?<=(\ud800\w))X/u,
107 "\ud800\udc00AX\udc11BX\ud800\ud800CX"); 109 "\ud800\udc00AX\udc11BX\ud800\ud800CX");
108 execl(["C", "\ud800\ud800"], /(?<=(\ud800.))\w/u, 110 execl(["C", "\ud800\ud800"], /(?<=(\ud800.))\w/u,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 tests(true, "...(?<=" + L + ")", X + T + L); 149 tests(true, "...(?<=" + L + ")", X + T + L);
148 tests(false, "...(?<=" + T + ")", X + L + T) 150 tests(false, "...(?<=" + T + ")", X + L + T)
149 tests(true, "..(?<=" + L + T + ")", X + L + T) 151 tests(true, "..(?<=" + L + T + ")", X + L + T)
150 tests(true, "..(?<=" + L + T + "(?<=" + L + T + "))", X + L + T); 152 tests(true, "..(?<=" + L + T + "(?<=" + L + T + "))", X + L + T);
151 tests(false, "..(?<=" + L + "(" + T + "))", X + L + T); 153 tests(false, "..(?<=" + L + "(" + T + "))", X + L + T);
152 tests(false, ".*" + L, X + L + T); 154 tests(false, ".*" + L, X + L + T);
153 tests(true, ".*" + L, X + L + L + T); 155 tests(true, ".*" + L, X + L + L + T);
154 tests(false, ".*" + L, X + L + T + L + T); 156 tests(false, ".*" + L, X + L + T + L + T);
155 tests(false, ".*" + T, X + L + T + L + T); 157 tests(false, ".*" + T, X + L + T + L + T);
156 tests(true, ".*" + T, X + L + T + T + L + T); 158 tests(true, ".*" + T, X + L + T + T + L + T);
OLDNEW
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698