Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Object / defineProperty / 15.2.3.6-4-97.js
blob8a5ada03318ae72f57a8e071c38cd5d2c858320a
1 // Copyright (c) 2012 Ecma International.  All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 es5id: 15.2.3.6-4-97
6 description: >
7     Object.defineProperty will throw TypeError when name.configurable
8     = false, name.[[Set]] is undefined, desc.[[Set]] refers to an
9     object (8.12.9 step 11.a.i)
10 includes: [propertyHelper.js]
11 ---*/
14 var obj = {};
16 function getFunc() {
17   return "property";
20 Object.defineProperty(obj, "property", {
21   get: getFunc,
22   configurable: false
23 });
25 try {
26   Object.defineProperty(obj, "property", {
27     get: getFunc,
28     set: function() {},
29     configurable: false
30   });
32   throw new Test262Error("Expected an exception.");
33 } catch (e) {
34   verifyEqualTo(obj, "property", getFunc());
36   if (!(e instanceof TypeError)) {
37     throw new Test262Error("Expected TypeError, got " + e);
38   }
41 verifyProperty(obj, "property", {
42   enumerable: false,
43   configurable: false,
44 });
46 reportCompare(0, 0);