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

Unified Diff: test/mjsunit/harmony/block-sloppy-function.js

Issue 1376623002: Extend Annex B 3.3 sloppy-mode block-scoped hoisting to scripts, eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 3 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/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/block-sloppy-function.js
diff --git a/test/mjsunit/harmony/block-sloppy-function.js b/test/mjsunit/harmony/block-sloppy-function.js
index a17a4c0799c7d9bced58941597f0b150f532ee7b..a28c71b63b5e8defb47f37a2d8f743c8f76f96af 100644
--- a/test/mjsunit/harmony/block-sloppy-function.js
+++ b/test/mjsunit/harmony/block-sloppy-function.js
@@ -146,12 +146,21 @@
assertEquals(2, f());
})();
-// Test that hoisting from blocks doesn't happen in global scope
-function globalUnhoisted() { return 0; }
+// Test that hoisting from blocks does happen in global scope
adamk 2015/09/29 23:23:15 More tests, please: - Negative cases: does not ho
+function globalHoisted() { return 0; }
{
- function globalUnhoisted() { return 1; }
+ function globalHoisted() { return 1; }
}
-assertEquals(0, globalUnhoisted());
+assertEquals(1, globalHoisted());
+
+// Test that hoisting from blocks does happen in an eval
+eval(`
+ function evalHoisted() { return 0; }
+ {
+ function evalHoisted() { return 1; }
+ }
+ assertEquals(1, evalHoisted());
+`);
// Test that shadowing arguments is fine
(function shadowArguments(x) {
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698