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

Unified Diff: test/cctest/test-parsing.cc

Issue 898983002: Add strong mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 8018bae88e0f41b4607a95ef60b0b3b6250f40bb..01c41bb9f2790ed5b62c48323cf51f1706abcc57 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1761,7 +1761,9 @@ TEST(ErrorsEvalAndArguments) {
// isn't.
const char* context_data[][2] = {
{ "\"use strict\";", "" },
+ { "\"use sanity\";", "" },
{ "var eval; function test_func() {\"use strict\"; ", "}"},
+ { "var eval; function test_func() {\"use sanity\"; ", "}"},
{ NULL, NULL }
};
@@ -1902,6 +1904,8 @@ TEST(ErrorsFutureStrictReservedWords) {
const char* context_data[][2] = {
{ "function test_func() {\"use strict\"; ", "}"},
{ "() => { \"use strict\"; ", "}" },
+ { "function test_func() {\"use sanity\"; ", "}"},
+ { "() => { \"use sanity\"; ", "}" },
{ NULL, NULL }
};
@@ -2096,6 +2100,13 @@ TEST(ErrorsYieldStrict) {
{ "\"use strict\"; (function not_gen() {", "})" },
{ "\"use strict\"; (function * gen() { (function not_gen() {", "}) })" },
{ "() => {\"use strict\"; ", "}" },
+ { "\"use sanity\";", "" },
+ { "\"use sanity\"; function not_gen() {", "}" },
+ { "function test_func() {\"use sanity\"; ", "}"},
+ { "\"use sanity\"; function * gen() { function not_gen() {", "} }" },
+ { "\"use sanity\"; (function not_gen() {", "})" },
+ { "\"use sanity\"; (function * gen() { (function not_gen() {", "}) })" },
+ { "() => {\"use sanity\"; ", "}" },
{ NULL, NULL }
};
@@ -2235,8 +2246,10 @@ TEST(ErrorsNameOfStrictFunction) {
const char* context_data[][2] = {
{ "function ", ""},
{ "\"use strict\"; function", ""},
+ { "\"use sanity\"; function", ""},
{ "function * ", ""},
{ "\"use strict\"; function * ", ""},
+ { "\"use sanity\"; function * ", ""},
{ NULL, NULL }
};
@@ -2315,6 +2328,9 @@ TEST(ErrorsIllegalWordsAsLabelsStrict) {
{ "\"use strict\";", "" },
{ "function test_func() {\"use strict\"; ", "}"},
{ "() => {\"use strict\"; ", "}" },
+ { "\"use sanity\";", "" },
+ { "function test_func() {\"use sanity\"; ", "}"},
+ { "() => {\"use sanity\"; ", "}" },
{ NULL, NULL }
};
@@ -2403,6 +2419,7 @@ TEST(NoErrorsParenthesizedDirectivePrologue) {
const char* statement_data[] = {
"(\"use strict\"); var eval;",
+ "(\"use sanity\"); var eval;",
NULL
};
@@ -2530,6 +2547,7 @@ TEST(FunctionDeclaresItselfStrict) {
const char* strict_statement_data[] = {
"\"use strict\";",
+ "\"use sanity\";",
NULL
};
@@ -2831,6 +2849,7 @@ TEST(StrictDelete) {
// "delete <Identifier>" is not allowed in strict mode.
const char* strict_context_data[][2] = {
{"\"use strict\"; ", ""},
+ {"\"use sanity\"; ", ""},
{ NULL, NULL }
};
@@ -4970,6 +4989,12 @@ TEST(DeclarationsError) {
{"'use strict'; for (;;)", ""},
{"'use strict'; for (x in y)", ""},
{"'use strict'; do ", " while (false)"},
+ {"'use sanity'; if (true)", ""},
+ {"'use sanity'; if (false) {} else", ""},
+ {"'use sanity'; while (false)", ""},
+ {"'use sanity'; for (;;)", ""},
+ {"'use sanity'; for (x in y)", ""},
+ {"'use sanity'; do ", " while (false)"},
{NULL, NULL}};
rossberg 2015/02/04 16:18:09 Maybe add a test checking multiple directives.
marja 2015/02/05 12:11:37 Done.
const char* statement_data[] = {

Powered by Google App Engine
This is Rietveld 408576698