Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2453)

Unified Diff: test/cctest/test-api.cc

Issue 7321006: Add GetPropertyAttribute method for Object in the API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 1531f905d1b078f6286418e3c0096e98350a8a66..075f9ac7f73277a092a2105b09e8d5e02d23f089 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,11 @@ 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));
}
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698