Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 35ac031a55171b733607ad36cbc058ab47699599..e0c9f3eb65b4d35db49356e965cbb08f5ac3b6e9 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -7738,3 +7738,18 @@ THREADED_TEST(PixelArray) { |
free(pixel_data); |
} |
+ |
+THREADED_TEST(ScriptContextDependence) { |
+ v8::HandleScope scope; |
+ LocalContext c1; |
+ const char *source = "foo"; |
+ v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); |
+ v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); |
+ c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); |
+ CHECK_EQ(dep->Run()->Int32Value(), 100); |
+ CHECK_EQ(indep->Run()->Int32Value(), 100); |
+ LocalContext c2; |
+ c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101)); |
+ CHECK_EQ(dep->Run()->Int32Value(), 100); |
+ CHECK_EQ(indep->Run()->Int32Value(), 101); |
+} |