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

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

Issue 1059273004: [strong] Implement static restrictions on direct eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cr feedback Created 5 years, 8 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
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index d0a516a7df4f8e5b2e60f6dead67905314e2c721..a0a39e563b126de96efc4b64aacc7c0566c8687d 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5911,6 +5911,36 @@ TEST(StrongUndefinedArrow) {
}
+TEST(StrongDirectEval) {
+ const char* context_data[][2] = {{"", ""}, {NULL}};
+
+ const char* error_data[] = {
+ "'use strong'; eval();",
+ "'use strong'; eval([]);",
+ "'use strong'; (eval)();",
+ "'use strong'; (((eval)))();",
+ "'use strong'; eval('function f() {}');",
+ "'use strong'; function f() {eval()}",
marja 2015/04/13 19:13:07 For this kind of a test, it would be useful to put
+ NULL};
+
+ const char* success_data[] = {
+ "'use strong'; eval;",
+ "'use strong'; eval`foo`;",
+ "'use strong'; let foo = eval; foo();",
+ "'use strong'; (1, eval)();",
+ NULL};
+
+ static const ParserFlag always_flags[] = {
+ kAllowStrongMode
+ };
+
+ RunParserSyncTest(context_data, error_data, kError, NULL, 0,
+ always_flags, arraysize(always_flags));
+ RunParserSyncTest(context_data, success_data, kSuccess, NULL, 0,
+ always_flags, arraysize(always_flags));
+}
+
+
TEST(ArrowFunctionASIErrors) {
const char* context_data[][2] = {{"'use strict';", ""}, {"", ""},
{NULL, NULL}};
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698