Index: test/cctest/test-accessors.cc |
diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc |
index 2f7e7f4e7d563b443a2cbb96de6cf500df85f79f..b68b0b0011bfafa3d521dfa99ed1406524d1c897 100644 |
--- a/test/cctest/test-accessors.cc |
+++ b/test/cctest/test-accessors.cc |
@@ -49,6 +49,12 @@ static void handle_property(Local<String> name, |
info.GetReturnValue().Set(v8_num(900)); |
} |
+static void handle_property_2(Local<String> name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ ApiTestFuzzer::Fuzz(); |
+ info.GetReturnValue().Set(v8_num(902)); |
+} |
+ |
static void handle_property(const v8::FunctionCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
@@ -67,16 +73,27 @@ THREADED_TEST(PropertyHandler) { |
getter_templ->SetLength(0); |
fun_templ-> |
InstanceTemplate()->SetAccessorProperty(v8_str("bar"), getter_templ); |
+ fun_templ->InstanceTemplate()-> |
+ SetNativeDataProperty(v8_str("instance_foo"), handle_property); |
+ fun_templ->SetNativeDataProperty(v8_str("object_foo"), handle_property_2); |
Local<Function> fun = fun_templ->GetFunction(); |
env->Global()->Set(v8_str("Fun"), fun); |
- Local<Script> getter = v8_compile("var obj = new Fun(); obj.foo;"); |
+ Local<Script> getter; |
+ Local<Script> setter; |
+ // check function instance accessors |
+ getter = v8_compile("var obj = new Fun(); obj.instance_foo;"); |
CHECK_EQ(900, getter->Run()->Int32Value()); |
- Local<Script> setter = v8_compile("obj.foo = 901;"); |
+ setter = v8_compile("obj.instance_foo = 901;"); |
CHECK_EQ(901, setter->Run()->Int32Value()); |
getter = v8_compile("obj.bar;"); |
CHECK_EQ(907, getter->Run()->Int32Value()); |
setter = v8_compile("obj.bar = 908;"); |
CHECK_EQ(908, setter->Run()->Int32Value()); |
+ // check function static accessors |
+ getter = v8_compile("Fun.object_foo;"); |
+ CHECK_EQ(902, getter->Run()->Int32Value()); |
+ setter = v8_compile("Fun.object_foo = 903;"); |
+ CHECK_EQ(903, setter->Run()->Int32Value()); |
} |