summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js')
-rw-r--r--js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js b/js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js
new file mode 100644
index 0000000000..fbb5e0e0a2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-additional-properties-of-the-object.prototype-object
+description: Behavior when property exists and is not configurable
+info: |
+ [...]
+ 5. Perform ? DefinePropertyOrThrow(O, key, desc).
+features: [__getter__]
+---*/
+
+var noop = function() {};
+var subject = Object.defineProperty(
+ {}, 'attr', { value: 1, configurable: false }
+);
+
+assert.sameValue(typeof Object.prototype.__defineGetter__, 'function');
+
+assert.throws(TypeError, function() {
+ subject.__defineGetter__('attr', noop);
+});
+
+reportCompare(0, 0);