Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index d7621d12cf2ff1af6c02c36abd4c626b418eb612..bad853a395584d9e76b225544fffd568552f76b2 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -30,6 +30,7 @@ |
#include "v8.h" |
#include "api.h" |
+#include "isolate.h" |
#include "compilation-cache.h" |
#include "execution.h" |
#include "snapshot.h" |
@@ -13373,6 +13374,30 @@ TEST(MultipleIsolatesOnIndividualThreads) { |
isolate2->Dispose(); |
} |
+TEST(IsolateDifferentContexts) { |
+ v8::Isolate* isolate = v8::Isolate::New(); |
+ Persistent<v8::Context> context; |
+ { |
+ v8::Isolate::Scope isolate_scope(isolate); |
+ v8::HandleScope handle_scope; |
+ context = v8::Context::New(); |
Vitaly Repeshko
2011/04/15 00:29:39
Why don't you use Context::Scope here?
Dmitry Lomov
2011/04/19 01:50:47
Done.
|
+ context->Enter(); |
+ Local<Value> v = CompileRun("2"); |
+ CHECK(v->IsNumber()); |
+ CHECK_EQ(2, static_cast<int>(v->NumberValue())); |
+ context->Exit(); |
+ } |
+ { |
+ v8::Isolate::Scope isolate_scope(isolate); |
+ v8::HandleScope handle_scope; |
+ context = v8::Context::New(); |
+ context->Enter(); |
+ Local<Value> v = CompileRun("22"); |
+ CHECK(v->IsNumber()); |
+ CHECK_EQ(22, static_cast<int>(v->NumberValue())); |
+ context->Exit(); |
+ } |
+} |
class InitDefaultIsolateThread : public v8::internal::Thread { |
public: |