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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2946953002: Revert of [parser] Forbid \08 in strict strings (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/parsing/scanner.cc ('k') | test/mjsunit/es6/templates.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5883 matching lines...) Expand 10 before | Expand all | Expand 10 after
5894 "\"foob\\{uc481}r\"", 5894 "\"foob\\{uc481}r\"",
5895 // This character is a valid unicode character, representable as a surrogate 5895 // This character is a valid unicode character, representable as a surrogate
5896 // pair, not representable as 4 hex digits. 5896 // pair, not representable as 4 hex digits.
5897 "\"foo\\u{10e6d}\"", 5897 "\"foo\\u{10e6d}\"",
5898 // Max value for the unicode escape 5898 // Max value for the unicode escape
5899 "\"\\u{10ffff}\"", 5899 "\"\\u{10ffff}\"",
5900 NULL}; 5900 NULL};
5901 RunParserSyncTest(context_data, data, kSuccess); 5901 RunParserSyncTest(context_data, data, kSuccess);
5902 } 5902 }
5903 5903
5904 TEST(OctalEscapes) {
5905 const char* sloppy_context_data[][2] = {{"", ""}, // as a directive
5906 {"0;", ""}, // as a string literal
5907 {NULL, NULL}};
5908
5909 const char* strict_context_data[][2] = {
5910 {"'use strict';", ""}, // as a directive before 'use strict'
5911 {"", ";'use strict';"}, // as a directive after 'use strict'
5912 {"'use strict'; 0;", ""}, // as a string literal
5913 {NULL, NULL}};
5914
5915 // clang-format off
5916 const char* data[] = {
5917 "'\\1'",
5918 "'\\01'",
5919 "'\\001'",
5920 "'\\08'",
5921 "'\\09'",
5922 NULL};
5923 // clang-format on
5924
5925 // Permitted in sloppy mode
5926 RunParserSyncTest(sloppy_context_data, data, kSuccess);
5927
5928 // Error in strict mode
5929 RunParserSyncTest(strict_context_data, data, kError);
5930 }
5931 5904
5932 TEST(ScanTemplateLiterals) { 5905 TEST(ScanTemplateLiterals) {
5933 const char* context_data[][2] = {{"'use strict';", ""}, 5906 const char* context_data[][2] = {{"'use strict';", ""},
5934 {"function foo(){ 'use strict';" 5907 {"function foo(){ 'use strict';"
5935 " var a, b, c; return ", "}"}, 5908 " var a, b, c; return ", "}"},
5936 {NULL, NULL}}; 5909 {NULL, NULL}};
5937 5910
5938 const char* data[] = { 5911 const char* data[] = {
5939 "``", 5912 "``",
5940 "`no-subst-template`", 5913 "`no-subst-template`",
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
7132 7105
7133 TEST(TemplateEscapesPositiveTests) { 7106 TEST(TemplateEscapesPositiveTests) {
7134 // clang-format off 7107 // clang-format off
7135 const char* context_data[][2] = { 7108 const char* context_data[][2] = {
7136 {"", ""}, 7109 {"", ""},
7137 {"'use strict';", ""}, 7110 {"'use strict';", ""},
7138 {NULL, NULL}}; 7111 {NULL, NULL}};
7139 7112
7140 // clang-format off 7113 // clang-format off
7141 const char* data[] = { 7114 const char* data[] = {
7142 "tag`\\08`",
7143 "tag`\\01`", 7115 "tag`\\01`",
7144 "tag`\\01${0}right`", 7116 "tag`\\01${0}right`",
7145 "tag`left${0}\\01`", 7117 "tag`left${0}\\01`",
7146 "tag`left${0}\\01${1}right`", 7118 "tag`left${0}\\01${1}right`",
7147 "tag`\\1`", 7119 "tag`\\1`",
7148 "tag`\\1${0}right`", 7120 "tag`\\1${0}right`",
7149 "tag`left${0}\\1`", 7121 "tag`left${0}\\1`",
7150 "tag`left${0}\\1${1}right`", 7122 "tag`left${0}\\1${1}right`",
7151 "tag`\\xg`", 7123 "tag`\\xg`",
7152 "tag`\\xg${0}right`", 7124 "tag`\\xg${0}right`",
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
7216 7188
7217 TEST(TemplateEscapesNegativeTests) { 7189 TEST(TemplateEscapesNegativeTests) {
7218 // clang-format off 7190 // clang-format off
7219 const char* context_data[][2] = { 7191 const char* context_data[][2] = {
7220 {"", ""}, 7192 {"", ""},
7221 {"'use strict';", ""}, 7193 {"'use strict';", ""},
7222 {NULL, NULL}}; 7194 {NULL, NULL}};
7223 7195
7224 // clang-format off 7196 // clang-format off
7225 const char* data[] = { 7197 const char* data[] = {
7226 "`\\08`",
7227 "`\\01`", 7198 "`\\01`",
7228 "`\\01${0}right`", 7199 "`\\01${0}right`",
7229 "`left${0}\\01`", 7200 "`left${0}\\01`",
7230 "`left${0}\\01${1}right`", 7201 "`left${0}\\01${1}right`",
7231 "`\\1`", 7202 "`\\1`",
7232 "`\\1${0}right`", 7203 "`\\1${0}right`",
7233 "`left${0}\\1`", 7204 "`left${0}\\1`",
7234 "`left${0}\\1${1}right`", 7205 "`left${0}\\1${1}right`",
7235 "`\\xg`", 7206 "`\\xg`",
7236 "`\\xg${0}right`", 7207 "`\\xg${0}right`",
(...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after
10368 CHECK(loop_var->IsStackLocal()); 10339 CHECK(loop_var->IsStackLocal());
10369 CHECK_EQ(loop_block->ContextLocalCount(), 0); 10340 CHECK_EQ(loop_block->ContextLocalCount(), 0);
10370 10341
10371 i::Variable* loop_var2 = loop_block->inner_scope()->LookupLocal(var_name); 10342 i::Variable* loop_var2 = loop_block->inner_scope()->LookupLocal(var_name);
10372 CHECK_NE(loop_var, loop_var2); 10343 CHECK_NE(loop_var, loop_var2);
10373 CHECK(loop_var2->IsContextSlot()); 10344 CHECK(loop_var2->IsContextSlot());
10374 CHECK_EQ(loop_block->inner_scope()->ContextLocalCount(), 1); 10345 CHECK_EQ(loop_block->inner_scope()->ContextLocalCount(), 1);
10375 }); 10346 });
10376 } 10347 }
10377 } 10348 }
OLDNEW
« no previous file with comments | « src/parsing/scanner.cc ('k') | test/mjsunit/es6/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698