Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index e0bcbc92cfabfcdace40f8c63937d20167879516..6b6befb88b57f77603344048061514edb3f02605 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -6842,6 +6842,47 @@ THREADED_TEST(SetPrototype) { |
} |
+THREADED_TEST(SetPrototypeProperties) { |
+ ASSERT(i::FunctionTemplateInfo::kPrototypePropertiesOffset == |
Mads Ager (chromium)
2011/06/22 12:13:46
This assert seems like an internal detail that we
Jakob Kummerow
2011/06/22 12:36:59
Done. Removed.
|
+ 15*i::kPointerSize + i::HeapObject::kHeaderSize); |
+ v8::HandleScope handle_scope; |
+ LocalContext context; |
+ |
+ Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); |
+ t1->SetPrototypeProperties(v8::DontDelete); |
+ context->Global()->Set(v8_str("func1"), t1->GetFunction()); |
+ CHECK(CompileRun( |
+ "(function() {" |
+ " descriptor = Object.getOwnPropertyDescriptor(func1, 'prototype');" |
+ " return (descriptor['writable'] == true) &&" |
+ " (descriptor['enumerable'] == true) &&" |
+ " (descriptor['configurable'] == false);" |
+ "})()")->BooleanValue()); |
+ |
+ Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(); |
+ t2->SetPrototypeProperties(v8::DontEnum); |
+ context->Global()->Set(v8_str("func2"), t2->GetFunction()); |
+ CHECK(CompileRun( |
+ "(function() {" |
+ " descriptor = Object.getOwnPropertyDescriptor(func2, 'prototype');" |
+ " return (descriptor['writable'] == true) &&" |
+ " (descriptor['enumerable'] == false) &&" |
+ " (descriptor['configurable'] == true);" |
+ "})()")->BooleanValue()); |
+ |
+ Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(); |
+ t3->SetPrototypeProperties(v8::ReadOnly); |
+ context->Global()->Set(v8_str("func3"), t3->GetFunction()); |
+ CHECK(CompileRun( |
+ "(function() {" |
+ " descriptor = Object.getOwnPropertyDescriptor(func3, 'prototype');" |
+ " return (descriptor['writable'] == false) &&" |
+ " (descriptor['enumerable'] == true) &&" |
+ " (descriptor['configurable'] == true);" |
+ "})()")->BooleanValue()); |
+} |
Mads Ager (chromium)
2011/06/22 12:13:46
Let's add a test for the combination of all three
Jakob Kummerow
2011/06/22 12:36:59
Done.
|
+ |
+ |
THREADED_TEST(SetPrototypeThrows) { |
v8::HandleScope handle_scope; |
LocalContext context; |