Index: test/unittests/api/v8-object-unittest.cc |
diff --git a/test/unittests/api/v8-object-unittest.cc b/test/unittests/api/v8-object-unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5d6ca804ad0303e994194e83d2cd90ef18a2b4bc |
--- /dev/null |
+++ b/test/unittests/api/v8-object-unittest.cc |
@@ -0,0 +1,39 @@ |
+// Copyright 2017 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "include/v8.h" |
+#include "test/unittests/test-utils.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace v8 { |
+namespace { |
+ |
+using ObjectTest = TestWithContext; |
+ |
+void accessor_name_getter_callback(Local<Name>, |
+ const PropertyCallbackInfo<Value>&) {} |
+ |
+TEST_F(ObjectTest, SetAccessorWhenUnconfigurablePropAlreadyDefined) { |
+ Context::Scope context_scope(context()); |
+ |
+ TryCatch try_catch(isolate()); |
+ |
+ Local<Object> global = context()->Global(); |
+ Local<String> property_name = |
+ String::NewFromUtf8(isolate(), "foo", NewStringType::kNormal) |
+ .ToLocalChecked(); |
+ |
+ PropertyDescriptor prop_desc; |
+ prop_desc.set_configurable(false); |
+ global->DefineProperty(context(), property_name, prop_desc).ToChecked(); |
+ |
+ Maybe<bool> result = global->SetAccessor(context(), property_name, |
+ accessor_name_getter_callback); |
+ ASSERT_TRUE(result.IsJust()); |
+ ASSERT_FALSE(result.FromJust()); |
+ ASSERT_FALSE(try_catch.HasCaught()); |
+} |
+ |
+} // namespace |
+} // namespace v8 |