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

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

Issue 2724003006: [parser] Correctly handle invalid escapes in adjacent template tokens. (Closed)
Patch Set: MoveErrorTo takes a TokenDesc* Created 3 years, 9 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/cctest/test-parsing.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-template-escapes 5 // Flags: --harmony-template-escapes
6 6
7 function check({cooked, raw, exprs}) { 7 function check({cooked, raw, exprs}) {
8 return function(strs, ...args) { 8 return function(strs, ...args) {
9 assertArrayEquals(cooked, strs); 9 assertArrayEquals(cooked, strs);
10 assertArrayEquals(raw, strs.raw); 10 assertArrayEquals(raw, strs.raw);
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 'raw': [ 776 'raw': [
777 'left', 777 'left',
778 '\\u{110000}', 778 '\\u{110000}',
779 'right' 779 'right'
780 ], 780 ],
781 'exprs': [ 781 'exprs': [
782 0, 782 0,
783 1 783 1
784 ] 784 ]
785 })`left${0}\u{110000}${1}right`; 785 })`left${0}\u{110000}${1}right`;
786
787
788
789 function checkMultiple(expectedArray) {
790 let results = [];
791 return function consume(strs, ...args) {
792 if (typeof strs === 'undefined') {
793 assertArrayEquals(expectedArray, results);
794 } else {
795 results.push({cooked: strs, raw: strs.raw, exprs: args});
796 return consume;
797 }
798 };
799 }
800
801
802 checkMultiple([{
803 'cooked': [
804 undefined
805 ],
806 'raw': [
807 '\\u',
808 ],
809 'exprs': []
810 }, {
811 'cooked': [
812 undefined
813 ],
814 'raw': [
815 '\\u',
816 ],
817 'exprs': []
818 }])`\u``\u`();
819
820 checkMultiple([{
821 'cooked': [
822 ' '
823 ],
824 'raw': [
825 ' ',
826 ],
827 'exprs': []
828 }, {
829 'cooked': [
830 undefined
831 ],
832 'raw': [
833 '\\u',
834 ],
835 'exprs': []
836 }])` ``\u`();
837
838 checkMultiple([{
839 'cooked': [
840 undefined
841 ],
842 'raw': [
843 '\\u',
844 ],
845 'exprs': []
846 }, {
847 'cooked': [
848 ' '
849 ],
850 'raw': [
851 ' ',
852 ],
853 'exprs': []
854 }])`\u`` `();
855
856 checkMultiple([{
857 'cooked': [
858 ' '
859 ],
860 'raw': [
861 ' ',
862 ],
863 'exprs': []
864 }, {
865 'cooked': [
866 ' '
867 ],
868 'raw': [
869 ' ',
870 ],
871 'exprs': []
872 }])` `` `();
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698