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

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

Issue 650663003: harmony-scoping: Correct dynamic lookups on a top level. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback + rebase Created 6 years, 2 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/contexts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-decls.cc
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index 34f0b69643e05c90bc8450d361205dbd748d05dd..f2ccdab6c0162f9b70924759dbfa80f576c80590 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -713,3 +713,37 @@ TEST(CrossScriptConflicts) {
}
}
}
+
+
+TEST(CrossScriptDynamicLookup) {
+ i::FLAG_harmony_scoping = true;
+
+ HandleScope handle_scope(CcTest::isolate());
+
+ {
+ SimpleContext context;
+ Local<String> undefined_string = String::NewFromUtf8(
+ CcTest::isolate(), "undefined", String::kInternalizedString);
+ Local<String> number_string = String::NewFromUtf8(
+ CcTest::isolate(), "number", String::kInternalizedString);
+
+ context.Check(
+ "function f(o) { with(o) { return x; } }"
+ "function g(o) { with(o) { x = 15; } }"
+ "function h(o) { with(o) { return typeof x; } }",
+ EXPECT_RESULT, Undefined(CcTest::isolate()));
+ context.Check("h({})", EXPECT_RESULT, undefined_string);
+ context.Check(
+ "'use strict';"
+ "let x = 1;"
+ "f({})",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 1));
+ context.Check(
+ "'use strict';"
+ "g({});"
+ "x",
+ EXPECT_RESULT, Number::New(CcTest::isolate(), 15));
+ context.Check("f({})", EXPECT_RESULT, Number::New(CcTest::isolate(), 15));
+ context.Check("h({})", EXPECT_RESULT, number_string);
+ }
+}
« no previous file with comments | « src/contexts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698