• Home
  • Raw
  • Download

Lines Matching full:u

5 // ES6 extends the \uxxxx escape and also allows \u{xxxxx}.
18 testRegexpHelper(/(\u0066|\u0062)oo/u);
19 testRegexpHelper(/(\u{0066}|\u{0062})oo/u);
20 testRegexpHelper(/(\u{66}|\u{000062})oo/u);
25 testRegexpHelper(new RegExp("(\\u0066|\\u0062)oo", "u"));
26 testRegexpHelper(new RegExp("(\\u{0066}|\\u{0062})oo", "u"));
27 testRegexpHelper(new RegExp("(\\u{66}|\\u{000062})oo", "u"));
31 testRegexpHelper(new RegExp("(\u0066|\u0062)oo", "u"));
32 testRegexpHelper(new RegExp("(\u{0066}|\u{0062})oo", "u"));
33 testRegexpHelper(new RegExp("(\u{66}|\u{000062})oo", "u"));
39 testRegexpHelper(/[\u0062-\u0066]oo/u);
40 testRegexpHelper(/[\u{0062}-\u{0066}]oo/u);
41 testRegexpHelper(/[\u{62}-\u{00000066}]oo/u);
46 testRegexpHelper(new RegExp("[\\u0062-\\u0066]oo", "u"));
47 testRegexpHelper(new RegExp("[\\u{0062}-\\u{0066}]oo", "u"));
48 testRegexpHelper(new RegExp("[\\u{62}-\\u{00000066}]oo", "u"));
52 testRegexpHelper(new RegExp("[\u0062-\u0066]oo", "u"));
53 testRegexpHelper(new RegExp("[\u{0062}-\u{0066}]oo", "u"));
54 testRegexpHelper(new RegExp("[\u{62}-\u{00000066}]oo", "u"));
59 // \u followed by illegal escape will be parsed as u. {x} will be the
67 helper1(/f\u{2}bar/);
68 helper1(new RegExp("f\\u{2}bar"));
77 helper2(/f\u{1,2}bar/);
78 helper2(new RegExp("f\\u{1,2}bar"));
81 assertTrue(r.test("u"));
89 helper3(/[\u{2}]/);
90 helper3(new RegExp("[\\u{2}]"));
95 // Without the u flag, invalid unicode escapes and other invalid escapes are
100 helper1(/first\u\x\z\8\9second/);
101 helper1(new RegExp("first\\u\\x\\z\\8\\9second"));
104 assertTrue(r.test("u"));
112 helper2(/[\u\x\z\8\9]/);
113 helper2(new RegExp("[\\u\\x\\z\\8\\9]"));
115 // However, with the u flag, these are treated as invalid escapes.
116 assertThrows("/\\u/u", SyntaxError);
117 assertThrows("/\\u12/u", SyntaxError);
118 assertThrows("/\\ufoo/u", SyntaxError);
119 assertThrows("/\\x/u", SyntaxError);
120 assertThrows("/\\xfoo/u", SyntaxError);
121 assertThrows("/\\z/u", SyntaxError);
122 assertThrows("/\\8/u", SyntaxError);
123 assertThrows("/\\9/u", SyntaxError);
125 assertThrows("new RegExp('\\\\u', 'u')", SyntaxError);
126 assertThrows("new RegExp('\\\\u12', 'u')", SyntaxError);
127 assertThrows("new RegExp('\\\\ufoo', 'u')", SyntaxError);
128 assertThrows("new RegExp('\\\\x', 'u')", SyntaxError);
129 assertThrows("new RegExp('\\\\xfoo', 'u')", SyntaxError);
130 assertThrows("new RegExp('\\\\z', 'u')", SyntaxError);
131 assertThrows("new RegExp('\\\\8', 'u')", SyntaxError);
132 assertThrows("new RegExp('\\\\9', 'u')", SyntaxError);
137 // The hex number inside \u{} has a maximum value.
138 /\u{10ffff}/u
139 new RegExp("\\u{10ffff}", "u")
140 assertThrows("/\\u{110000}/u", SyntaxError);
141 assertThrows("new RegExp('\\\\u{110000}', 'u')", SyntaxError);
143 // Without the u flag, they're of course fine ({x} is the count).
144 /\u{110000}/
145 new RegExp("\\u{110000}")
150 // Syntax escapes work the same with or without the u flag.
157 helper(/foo\[bar/u);
158 helper(new RegExp("foo\\[bar", "u"));
163 // U+10E6D corresponds to the surrogate pair [U+D803, U+DE6D].
165 assertTrue(r.test("foo\u{10e6d}bar"));
167 helper(/foo\ud803\ude6dbar/u);
168 helper(new RegExp("foo\\ud803\\ude6dbar", "u"));
199 // Test that duplicating the u flag is not allowed.
206 // Test that the u flag is included in the string representation of regexps.
208 assertEquals(r.toString(), "/foo/u");
210 helper(/foo/u);
211 helper(new RegExp("foo", "u"));
216 assertTrue(new RegExp("\u{12345}", "u").test("\u{12345}"));
217 assertTrue(/\u{12345}/u.test("\u{12345}"));
218 assertTrue(new RegExp("\u{12345}", "u").test("\ud808\udf45"));
219 assertTrue(/\u{12345}/u.test("\ud808\udf45"));
220 assertFalse(new RegExp("\u{12345}", "u").test("\udf45"));
221 assertFalse(/\u{12345}/u.test("\udf45"));
224 assertTrue(new RegExp("\u{12345}\u{23456}", "u").test("a\u{12345}\u{23456}b"));
225 assertTrue(/\u{12345}\u{23456}/u.test("b\u{12345}\u{23456}c"));
226 assertFalse(new RegExp("\u{12345}\u{23456}", "u").test("a\udf45\u{23456}b"));
227 assertFalse(/\u{12345}\u{23456}/u.test("b\udf45\u{23456}c"));
230 assertTrue(new RegExp("\u{12345}(?:\u{23456})", "u").test(
231 "a\u{12345}\u{23456}b"));
232 assertTrue(/\u{12345}(?:\u{23456})/u.test("b\u{12345}\u{23456}c"));
233 assertFalse(new RegExp("\u{12345}(?:\u{23456})", "u").test(
234 "a\udf45\u{23456}b"));
235 assertFalse(/\u{12345}(?:\u{23456})/u.test("b\udf45\u{23456}c"));
238 assertTrue(new RegExp("\u{12345}|\u{23456}", "u").test("a\u{12345}b"));
239 assertTrue(/\u{12345}|\u{23456}/u.test("b\u{23456}c"));
240 assertFalse(new RegExp("\u{12345}|\u{23456}", "u").test("a\udf45\ud84db"));
241 assertFalse(/\u{12345}|\u{23456}/u.test("b\udf45\ud808c"));
244 assertTrue(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test(
245 "\u{12345}b\u{12345}"));
246 assertTrue(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{12345}"));
247 assertFalse(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test(
248 "\u{12345}b\u{23456}"));
249 assertFalse(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{23456}"));
252 assertTrue(new RegExp("\u{12345}{3}", "u").test("\u{12345}\u{12345}\u{12345}"));
253 assertTrue(/\u{12345}{3}/u.test("\u{12345}\u{12345}\u{12345}"));
254 assertTrue(new RegExp("\u{12345}{3}").test("\u{12345}\udf45\udf45"));
255 assertTrue(/\ud808\udf45{3}/u.test("\u{12345}\udf45\udf45"));
256 assertFalse(new RegExp("\u{12345}{3}", "u").test("\u{12345}\udf45\udf45"));
257 assertFalse(/\u{12345}{3}/u.test("\u{12345}\udf45\udf45"));