summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js b/js/src/tests/test262/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js
new file mode 100644
index 0000000000..76eb3119b6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 8.12.9-9-c-i_2
+description: >
+ Redefine a configurable accessor property to be a data property on
+ a non-extensible object
+---*/
+
+var o = {};
+Object.defineProperty(o, "foo",
+{
+ get: function() {
+ return 5;
+ },
+ configurable: true
+});
+Object.preventExtensions(o);
+Object.defineProperty(o, "foo",
+{
+ value: "hello",
+ writable: true
+});
+
+var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo");
+
+assert.sameValue(o.foo, "hello", 'o.foo');
+assert.sameValue(fooDescrip.get, undefined, 'fooDescrip.get');
+assert.sameValue(fooDescrip.set, undefined, 'fooDescrip.set');
+assert.sameValue(fooDescrip.value, "hello", 'fooDescrip.value');
+assert.sameValue(fooDescrip.configurable, true, 'fooDescrip.configurable');
+assert.sameValue(fooDescrip.enumerable, false, 'fooDescrip.enumerable');
+assert.sameValue(fooDescrip.writable, true, 'fooDescrip.writable');
+
+reportCompare(0, 0);