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

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

Issue 73072: Allow using with and eval in JS extensions in debug mode by... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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/parser.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-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 1700)
+++ test/cctest/test-api.cc (working copy)
@@ -2495,6 +2495,44 @@
}
+static const char* kEvalExtensionSource =
+ "function UseEval() {"
+ " var x = 42;"
+ " return eval('x');"
+ "}";
+
+
+THREADED_TEST(UseEvalFromExtension) {
+ v8::HandleScope handle_scope;
+ v8::RegisterExtension(new Extension("evaltest", kEvalExtensionSource));
+ const char* extension_names[] = { "evaltest" };
+ v8::ExtensionConfiguration extensions(1, extension_names);
+ v8::Handle<Context> context = Context::New(&extensions);
+ Context::Scope lock(context);
+ v8::Handle<Value> result = Script::Compile(v8_str("UseEval()"))->Run();
+ CHECK_EQ(result, v8::Integer::New(42));
+}
+
+
+static const char* kWithExtensionSource =
+ "function UseWith() {"
+ " var x = 42;"
+ " with({x:87}) { return x; }"
+ "}";
+
+
+THREADED_TEST(UseWithFromExtension) {
+ v8::HandleScope handle_scope;
+ v8::RegisterExtension(new Extension("withtest", kWithExtensionSource));
+ const char* extension_names[] = { "withtest" };
+ v8::ExtensionConfiguration extensions(1, extension_names);
+ v8::Handle<Context> context = Context::New(&extensions);
+ Context::Scope lock(context);
+ v8::Handle<Value> result = Script::Compile(v8_str("UseWith()"))->Run();
+ CHECK_EQ(result, v8::Integer::New(87));
+}
+
+
THREADED_TEST(AutoExtensions) {
v8::HandleScope handle_scope;
Extension* extension = new Extension("autotest", kSimpleExtensionSource);
« 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