Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 8d8770f13236637d6bfc727aa5a0facbe398611c..74809c16e983446da41cd133cdc80ae45cdd85e0 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -2048,10 +2048,15 @@ THREADED_TEST(GetSetProperty) { |
THREADED_TEST(PropertyAttributes) { |
v8::HandleScope scope; |
LocalContext context; |
+ // none |
+ Local<String> prop = v8_str("none"); |
+ context->Global()->Set(prop, v8_num(7)); |
+ CHECK_EQ(v8::None, context->Global()->GetPropertyAttribute(prop)); |
// read-only |
- Local<String> prop = v8_str("read_only"); |
+ prop = v8_str("read_only"); |
context->Global()->Set(prop, v8_num(7), v8::ReadOnly); |
CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |
+ CHECK_EQ(v8::ReadOnly, context->Global()->GetPropertyAttribute(prop)); |
Script::Compile(v8_str("read_only = 9"))->Run(); |
CHECK_EQ(7, context->Global()->Get(prop)->Int32Value()); |
context->Global()->Set(prop, v8_num(10)); |
@@ -2062,6 +2067,25 @@ THREADED_TEST(PropertyAttributes) { |
CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |
Script::Compile(v8_str("delete dont_delete"))->Run(); |
CHECK_EQ(13, context->Global()->Get(prop)->Int32Value()); |
+ CHECK_EQ(v8::DontDelete, context->Global()->GetPropertyAttribute(prop)); |
+ // dont-enum |
+ prop = v8_str("dont_enum"); |
+ context->Global()->Set(prop, v8_num(28), v8::DontEnum); |
+ CHECK_EQ(v8::DontEnum, context->Global()->GetPropertyAttribute(prop)); |
+ // absent |
+ TryCatch try_catch; |
+ prop = v8_str("absent"); |
+ CHECK_EQ(v8::None, context->Global()->GetPropertyAttribute(prop)); |
+ CHECK(try_catch.HasCaught()); |
+ String::AsciiValue exception_value1(try_catch.Exception()); |
+ CHECK_EQ("ReferenceError: absent is not defined", *exception_value1); |
+ try_catch.Reset(); |
+ Local<Value> fake_prop = v8_num(1); |
+ CHECK_EQ(v8::None, context->Global()->GetPropertyAttribute(fake_prop)); |
+ CHECK(try_catch.HasCaught()); |
+ String::AsciiValue exception_value2(try_catch.Exception()); |
+ CHECK_EQ("ReferenceError: 1 is not defined", *exception_value2); |
+ try_catch.Reset(); |
Mads Ager (chromium)
2011/07/15 07:25:51
You should add a test where the string conversion
|
} |