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

Side by Side Diff: test/mjsunit/harmony/template-escapes.js

Issue 2665513002: [parser] Lift template literal invalid escape restriction (Closed)
Patch Set: reintroduce DCHECK_EQ Created 3 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 | « test/mjsunit/compiler/literals.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-template-escapes
6
7 function check({cooked, raw, exprs}) {
8 return function(strs, ...args) {
9 assertArrayEquals(cooked, strs);
10 assertArrayEquals(raw, strs.raw);
11 assertArrayEquals(exprs, args);
12 };
13 }
14
15 // clang-format off
16
17 check({
18 'cooked': [
19 undefined
20 ],
21 'raw': [
22 '\\01'
23 ],
24 'exprs': []
25 })`\01`;
26
27 check({
28 'cooked': [
29 undefined,
30 'right'
31 ],
32 'raw': [
33 '\\01',
34 'right'
35 ],
36 'exprs': [
37 0
38 ]
39 })`\01${0}right`;
40
41 check({
42 'cooked': [
43 'left',
44 undefined
45 ],
46 'raw': [
47 'left',
48 '\\01'
49 ],
50 'exprs': [
51 0
52 ]
53 })`left${0}\01`;
54
55 check({
56 'cooked': [
57 'left',
58 undefined,
59 'right'
60 ],
61 'raw': [
62 'left',
63 '\\01',
64 'right'
65 ],
66 'exprs': [
67 0,
68 1
69 ]
70 })`left${0}\01${1}right`;
71
72 check({
73 'cooked': [
74 undefined
75 ],
76 'raw': [
77 '\\1'
78 ],
79 'exprs': []
80 })`\1`;
81
82 check({
83 'cooked': [
84 undefined,
85 'right'
86 ],
87 'raw': [
88 '\\1',
89 'right'
90 ],
91 'exprs': [
92 0
93 ]
94 })`\1${0}right`;
95
96 check({
97 'cooked': [
98 'left',
99 undefined
100 ],
101 'raw': [
102 'left',
103 '\\1'
104 ],
105 'exprs': [
106 0
107 ]
108 })`left${0}\1`;
109
110 check({
111 'cooked': [
112 'left',
113 undefined,
114 'right'
115 ],
116 'raw': [
117 'left',
118 '\\1',
119 'right'
120 ],
121 'exprs': [
122 0,
123 1
124 ]
125 })`left${0}\1${1}right`;
126
127 check({
128 'cooked': [
129 undefined
130 ],
131 'raw': [
132 '\\xg'
133 ],
134 'exprs': []
135 })`\xg`;
136
137 check({
138 'cooked': [
139 undefined,
140 'right'
141 ],
142 'raw': [
143 '\\xg',
144 'right'
145 ],
146 'exprs': [
147 0
148 ]
149 })`\xg${0}right`;
150
151 check({
152 'cooked': [
153 'left',
154 undefined
155 ],
156 'raw': [
157 'left',
158 '\\xg'
159 ],
160 'exprs': [
161 0
162 ]
163 })`left${0}\xg`;
164
165 check({
166 'cooked': [
167 'left',
168 undefined,
169 'right'
170 ],
171 'raw': [
172 'left',
173 '\\xg',
174 'right'
175 ],
176 'exprs': [
177 0,
178 1
179 ]
180 })`left${0}\xg${1}right`;
181
182 check({
183 'cooked': [
184 undefined
185 ],
186 'raw': [
187 '\\xAg'
188 ],
189 'exprs': []
190 })`\xAg`;
191
192 check({
193 'cooked': [
194 undefined,
195 'right'
196 ],
197 'raw': [
198 '\\xAg',
199 'right'
200 ],
201 'exprs': [
202 0
203 ]
204 })`\xAg${0}right`;
205
206 check({
207 'cooked': [
208 'left',
209 undefined
210 ],
211 'raw': [
212 'left',
213 '\\xAg'
214 ],
215 'exprs': [
216 0
217 ]
218 })`left${0}\xAg`;
219
220 check({
221 'cooked': [
222 'left',
223 undefined,
224 'right'
225 ],
226 'raw': [
227 'left',
228 '\\xAg',
229 'right'
230 ],
231 'exprs': [
232 0,
233 1
234 ]
235 })`left${0}\xAg${1}right`;
236
237 check({
238 'cooked': [
239 undefined
240 ],
241 'raw': [
242 '\\u0'
243 ],
244 'exprs': []
245 })`\u0`;
246
247 check({
248 'cooked': [
249 undefined,
250 'right'
251 ],
252 'raw': [
253 '\\u0',
254 'right'
255 ],
256 'exprs': [
257 0
258 ]
259 })`\u0${0}right`;
260
261 check({
262 'cooked': [
263 'left',
264 undefined
265 ],
266 'raw': [
267 'left',
268 '\\u0'
269 ],
270 'exprs': [
271 0
272 ]
273 })`left${0}\u0`;
274
275 check({
276 'cooked': [
277 'left',
278 undefined,
279 'right'
280 ],
281 'raw': [
282 'left',
283 '\\u0',
284 'right'
285 ],
286 'exprs': [
287 0,
288 1
289 ]
290 })`left${0}\u0${1}right`;
291
292 check({
293 'cooked': [
294 undefined
295 ],
296 'raw': [
297 '\\u0g'
298 ],
299 'exprs': []
300 })`\u0g`;
301
302 check({
303 'cooked': [
304 undefined,
305 'right'
306 ],
307 'raw': [
308 '\\u0g',
309 'right'
310 ],
311 'exprs': [
312 0
313 ]
314 })`\u0g${0}right`;
315
316 check({
317 'cooked': [
318 'left',
319 undefined
320 ],
321 'raw': [
322 'left',
323 '\\u0g'
324 ],
325 'exprs': [
326 0
327 ]
328 })`left${0}\u0g`;
329
330 check({
331 'cooked': [
332 'left',
333 undefined,
334 'right'
335 ],
336 'raw': [
337 'left',
338 '\\u0g',
339 'right'
340 ],
341 'exprs': [
342 0,
343 1
344 ]
345 })`left${0}\u0g${1}right`;
346
347 check({
348 'cooked': [
349 undefined
350 ],
351 'raw': [
352 '\\u00g'
353 ],
354 'exprs': []
355 })`\u00g`;
356
357 check({
358 'cooked': [
359 undefined,
360 'right'
361 ],
362 'raw': [
363 '\\u00g',
364 'right'
365 ],
366 'exprs': [
367 0
368 ]
369 })`\u00g${0}right`;
370
371 check({
372 'cooked': [
373 'left',
374 undefined
375 ],
376 'raw': [
377 'left',
378 '\\u00g'
379 ],
380 'exprs': [
381 0
382 ]
383 })`left${0}\u00g`;
384
385 check({
386 'cooked': [
387 'left',
388 undefined,
389 'right'
390 ],
391 'raw': [
392 'left',
393 '\\u00g',
394 'right'
395 ],
396 'exprs': [
397 0,
398 1
399 ]
400 })`left${0}\u00g${1}right`;
401
402 check({
403 'cooked': [
404 undefined
405 ],
406 'raw': [
407 '\\u000g'
408 ],
409 'exprs': []
410 })`\u000g`;
411
412 check({
413 'cooked': [
414 undefined,
415 'right'
416 ],
417 'raw': [
418 '\\u000g',
419 'right'
420 ],
421 'exprs': [
422 0
423 ]
424 })`\u000g${0}right`;
425
426 check({
427 'cooked': [
428 'left',
429 undefined
430 ],
431 'raw': [
432 'left',
433 '\\u000g'
434 ],
435 'exprs': [
436 0
437 ]
438 })`left${0}\u000g`;
439
440 check({
441 'cooked': [
442 'left',
443 undefined,
444 'right'
445 ],
446 'raw': [
447 'left',
448 '\\u000g',
449 'right'
450 ],
451 'exprs': [
452 0,
453 1
454 ]
455 })`left${0}\u000g${1}right`;
456
457 check({
458 'cooked': [
459 undefined
460 ],
461 'raw': [
462 '\\u{}'
463 ],
464 'exprs': []
465 })`\u{}`;
466
467 check({
468 'cooked': [
469 undefined,
470 'right'
471 ],
472 'raw': [
473 '\\u{}',
474 'right'
475 ],
476 'exprs': [
477 0
478 ]
479 })`\u{}${0}right`;
480
481 check({
482 'cooked': [
483 'left',
484 undefined
485 ],
486 'raw': [
487 'left',
488 '\\u{}'
489 ],
490 'exprs': [
491 0
492 ]
493 })`left${0}\u{}`;
494
495 check({
496 'cooked': [
497 'left',
498 undefined,
499 'right'
500 ],
501 'raw': [
502 'left',
503 '\\u{}',
504 'right'
505 ],
506 'exprs': [
507 0,
508 1
509 ]
510 })`left${0}\u{}${1}right`;
511
512 check({
513 'cooked': [
514 undefined
515 ],
516 'raw': [
517 '\\u{-0}'
518 ],
519 'exprs': []
520 })`\u{-0}`;
521
522 check({
523 'cooked': [
524 undefined,
525 'right'
526 ],
527 'raw': [
528 '\\u{-0}',
529 'right'
530 ],
531 'exprs': [
532 0
533 ]
534 })`\u{-0}${0}right`;
535
536 check({
537 'cooked': [
538 'left',
539 undefined
540 ],
541 'raw': [
542 'left',
543 '\\u{-0}'
544 ],
545 'exprs': [
546 0
547 ]
548 })`left${0}\u{-0}`;
549
550 check({
551 'cooked': [
552 'left',
553 undefined,
554 'right'
555 ],
556 'raw': [
557 'left',
558 '\\u{-0}',
559 'right'
560 ],
561 'exprs': [
562 0,
563 1
564 ]
565 })`left${0}\u{-0}${1}right`;
566
567 check({
568 'cooked': [
569 undefined
570 ],
571 'raw': [
572 '\\u{g}'
573 ],
574 'exprs': []
575 })`\u{g}`;
576
577 check({
578 'cooked': [
579 undefined,
580 'right'
581 ],
582 'raw': [
583 '\\u{g}',
584 'right'
585 ],
586 'exprs': [
587 0
588 ]
589 })`\u{g}${0}right`;
590
591 check({
592 'cooked': [
593 'left',
594 undefined
595 ],
596 'raw': [
597 'left',
598 '\\u{g}'
599 ],
600 'exprs': [
601 0
602 ]
603 })`left${0}\u{g}`;
604
605 check({
606 'cooked': [
607 'left',
608 undefined,
609 'right'
610 ],
611 'raw': [
612 'left',
613 '\\u{g}',
614 'right'
615 ],
616 'exprs': [
617 0,
618 1
619 ]
620 })`left${0}\u{g}${1}right`;
621
622 check({
623 'cooked': [
624 undefined
625 ],
626 'raw': [
627 '\\u{0'
628 ],
629 'exprs': []
630 })`\u{0`;
631
632 check({
633 'cooked': [
634 undefined,
635 'right'
636 ],
637 'raw': [
638 '\\u{0',
639 'right'
640 ],
641 'exprs': [
642 0
643 ]
644 })`\u{0${0}right`;
645
646 check({
647 'cooked': [
648 'left',
649 undefined
650 ],
651 'raw': [
652 'left',
653 '\\u{0'
654 ],
655 'exprs': [
656 0
657 ]
658 })`left${0}\u{0`;
659
660 check({
661 'cooked': [
662 'left',
663 undefined,
664 'right'
665 ],
666 'raw': [
667 'left',
668 '\\u{0',
669 'right'
670 ],
671 'exprs': [
672 0,
673 1
674 ]
675 })`left${0}\u{0${1}right`;
676
677 check({
678 'cooked': [
679 undefined
680 ],
681 'raw': [
682 '\\u{\\u{0}'
683 ],
684 'exprs': []
685 })`\u{\u{0}`;
686
687 check({
688 'cooked': [
689 undefined,
690 'right'
691 ],
692 'raw': [
693 '\\u{\\u{0}',
694 'right'
695 ],
696 'exprs': [
697 0
698 ]
699 })`\u{\u{0}${0}right`;
700
701 check({
702 'cooked': [
703 'left',
704 undefined
705 ],
706 'raw': [
707 'left',
708 '\\u{\\u{0}'
709 ],
710 'exprs': [
711 0
712 ]
713 })`left${0}\u{\u{0}`;
714
715 check({
716 'cooked': [
717 'left',
718 undefined,
719 'right'
720 ],
721 'raw': [
722 'left',
723 '\\u{\\u{0}',
724 'right'
725 ],
726 'exprs': [
727 0,
728 1
729 ]
730 })`left${0}\u{\u{0}${1}right`;
731
732 check({
733 'cooked': [
734 undefined
735 ],
736 'raw': [
737 '\\u{110000}'
738 ],
739 'exprs': []
740 })`\u{110000}`;
741
742 check({
743 'cooked': [
744 undefined,
745 'right'
746 ],
747 'raw': [
748 '\\u{110000}',
749 'right'
750 ],
751 'exprs': [
752 0
753 ]
754 })`\u{110000}${0}right`;
755
756 check({
757 'cooked': [
758 'left',
759 undefined
760 ],
761 'raw': [
762 'left',
763 '\\u{110000}'
764 ],
765 'exprs': [
766 0
767 ]
768 })`left${0}\u{110000}`;
769
770 check({
771 'cooked': [
772 'left',
773 undefined,
774 'right'
775 ],
776 'raw': [
777 'left',
778 '\\u{110000}',
779 'right'
780 ],
781 'exprs': [
782 0,
783 1
784 ]
785 })`left${0}\u{110000}${1}right`;
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/literals.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698