Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 7cb3c04087b69d5238b904861e20d4aaf75fc3fa..e25642ed948b054c63f0c205467930d786fe982a 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -55,6 +55,8 @@ static const bool kLogThreading = false; |
using ::v8::AccessorInfo; |
using ::v8::Arguments; |
+using ::v8::Boolean; |
+using ::v8::BooleanObject; |
using ::v8::Context; |
using ::v8::Extension; |
using ::v8::Function; |
@@ -1544,6 +1546,54 @@ THREADED_TEST(BooleanObject) { |
} |
+THREADED_TEST(PrimitiveAndWrappedBooleans) { |
+ LocalContext env; |
+ v8::HandleScope scope(env->GetIsolate()); |
+ |
+ Local<Value> primitive_false = Boolean::New(false); |
+ CHECK(primitive_false->IsBoolean()); |
+ CHECK(!primitive_false->IsBooleanObject()); |
+ CHECK(!primitive_false->BooleanValue()); |
+ CHECK(!primitive_false->IsTrue()); |
+ CHECK(primitive_false->IsFalse()); |
+ |
+ Local<Value> false_value = BooleanObject::New(false); |
+ CHECK(!false_value->IsBoolean()); |
+ CHECK(false_value->IsBooleanObject()); |
+ CHECK(false_value->BooleanValue()); |
+ CHECK(!false_value->IsTrue()); |
+ CHECK(!false_value->IsFalse()); |
+ |
+ Local<BooleanObject> false_boolean_object = false_value.As<BooleanObject>(); |
+ CHECK(!false_boolean_object->IsBoolean()); |
+ CHECK(false_boolean_object->IsBooleanObject()); |
+ CHECK(!false_boolean_object->BooleanValue()); |
+ CHECK(!false_boolean_object->IsTrue()); |
+ CHECK(!false_boolean_object->IsFalse()); |
+ |
+ Local<Value> primitive_true = Boolean::New(true); |
+ CHECK(primitive_true->IsBoolean()); |
+ CHECK(!primitive_true->IsBooleanObject()); |
+ CHECK(primitive_true->BooleanValue()); |
+ CHECK(primitive_true->IsTrue()); |
+ CHECK(!primitive_true->IsFalse()); |
+ |
+ Local<Value> true_value = BooleanObject::New(true); |
+ CHECK(!true_value->IsBoolean()); |
+ CHECK(true_value->IsBooleanObject()); |
+ CHECK(true_value->BooleanValue()); |
+ CHECK(!true_value->IsTrue()); |
+ CHECK(!true_value->IsFalse()); |
+ |
+ Local<BooleanObject> true_boolean_object = true_value.As<BooleanObject>(); |
+ CHECK(!true_boolean_object->IsBoolean()); |
+ CHECK(true_boolean_object->IsBooleanObject()); |
+ CHECK(true_boolean_object->BooleanValue()); |
+ CHECK(!true_boolean_object->IsTrue()); |
+ CHECK(!true_boolean_object->IsFalse()); |
+} |
+ |
+ |
THREADED_TEST(Number) { |
LocalContext env; |
v8::HandleScope scope(env->GetIsolate()); |