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

Unified Diff: test/preparser/strict-function-statement.pyt

Issue 788143004: Update strict mode function declaration tests before block scoping. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « no previous file | test/preparser/testcfg.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/preparser/strict-function-statement.pyt
diff --git a/test/preparser/strict-function-statement.pyt b/test/preparser/strict-function-statement.pyt
index 08c4288cb8f2968c3729e117d89e79ec50c8b625..5542ee175942a2053ecdd9dead407b9ed1c9c096 100644
--- a/test/preparser/strict-function-statement.pyt
+++ b/test/preparser/strict-function-statement.pyt
@@ -29,71 +29,78 @@
# A template that performs the same strict-mode test in different
# scopes (global scope, function scope, and nested function scope).
-def StrictTest(name, source):
- Test(name, '"use strict";\n' + source, "strict_function")
+def StrictTest(name, source, legacy):
+ if legacy:
+ extra_flags = ["--noharmony-scoping"]
+ else:
+ extra_flags = []
+ Test(name, '"use strict";\n' + source, "strict_function",
+ extra_flags)
Test(name + '-infunc',
'function foo() {\n "use strict";\n' + source +'\n}\n',
- "strict_function")
+ "strict_function",
+ extra_flags)
Test(name + '-infunc2',
'function foo() {\n "use strict";\n function bar() {\n' +
source +'\n }\n}\n',
- "strict_function")
+ "strict_function",
+ extra_flags)
# Not testing with-scope, since with is not allowed in strict mode at all.
StrictTest("block", """
{ function foo() { } }
-""")
+""", True)
StrictTest("try-w-catch", """
try { function foo() { } } catch (e) { }
-""")
+""", True)
StrictTest("try-w-finally", """
try { function foo() { } } finally { }
-""")
+""", True)
StrictTest("catch", """
try { } catch (e) { function foo() { } }
-""")
+""", True)
StrictTest("finally", """
try { } finally { function foo() { } }
-""")
+""", True)
StrictTest("for", """
for (;;) { function foo() { } }
-""")
+""", True)
StrictTest("while", """
while (true) { function foo() { } }
-""")
+""", True)
StrictTest("do", """
do { function foo() { } } while (true);
-""")
+""", True)
StrictTest("then", """
if (true) { function foo() { } }
-""")
+""", True)
StrictTest("then-w-else", """
if (true) { function foo() { } } else { }
-""")
+""", True)
StrictTest("else", """
if (true) { } else { function foo() { } }
-""")
+""", True)
StrictTest("switch-case", """
switch (true) { case true: function foo() { } }
-""")
+""", False)
StrictTest("labeled", """
label: function foo() { }
-""")
+""", False)
« no previous file with comments | « no previous file | test/preparser/testcfg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698