Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 6c71de4ce2e2b282e229f6fcfcba3aa432badfb3..e8076cd4c697ef56d6af5be304a17c69019a4408 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -3188,6 +3188,44 @@ THREADED_TEST(GlobalHandleUpcast) { |
} |
+THREADED_TEST(HandleEquality) { |
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
+ v8::Persistent<String> global1; |
+ v8::Persistent<String> global2; |
+ { |
+ v8::HandleScope scope(isolate); |
+ global1.Reset(isolate, v8_str("str")); |
+ global2.Reset(isolate, v8_str("str2")); |
+ } |
+ CHECK_EQ(global1 == global1, true); |
+ CHECK_EQ(global1 != global1, false); |
+ { |
+ v8::HandleScope scope(isolate); |
+ Local<String> local1 = Local<String>::New(isolate, global1); |
+ Local<String> local2 = Local<String>::New(isolate, global2); |
+ |
+ CHECK_EQ(global1 == local1, true); |
+ CHECK_EQ(global1 != local1, false); |
+ CHECK_EQ(local1 == global1, true); |
+ CHECK_EQ(local1 != global1, false); |
+ |
+ CHECK_EQ(global1 == local2, false); |
+ CHECK_EQ(global1 != local2, true); |
+ CHECK_EQ(local2 == global1, false); |
+ CHECK_EQ(local2 != global1, true); |
+ |
+ CHECK_EQ(local1 == local2, false); |
+ CHECK_EQ(local1 != local2, true); |
+ |
+ Local<String> anotherLocal1 = Local<String>::New(isolate, global1); |
+ CHECK_EQ(local1 == anotherLocal1, true); |
+ CHECK_EQ(local1 != anotherLocal1, false); |
+ } |
+ global1.Dispose(); |
+ global2.Dispose(); |
+} |
+ |
+ |
THREADED_TEST(LocalHandle) { |
v8::HandleScope scope(v8::Isolate::GetCurrent()); |
v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |