Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Object / defineProperty / 15.2.3.6-4-538.js
blob8943f5cff9fcf2ed1331303e0b62107801b95c34
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-538
6 description: >
7     ES5 Attributes - success to update the accessor property ([[Get]]
8     is a Function, [[Set]] is a Function, [[Enumerable]] is true,
9     [[Configurable]] is true) to a data property
10 includes: [propertyHelper.js]
11 ---*/
13 var obj = {};
15 var getFunc = function() {
16   return 1001;
19 var verifySetFunc = "data";
20 var setFunc = function(value) {
21   verifySetFunc = value;
24 Object.defineProperty(obj, "prop", {
25   get: getFunc,
26   set: setFunc,
27   enumerable: true,
28   configurable: true
29 });
30 var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
32 Object.defineProperty(obj, "prop", {
33   value: 1001
34 });
35 var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
37 if (!desc1.hasOwnProperty("get")) {
38   throw new Test262Error('Expected desc1.hasOwnProperty("get") to be true, actually ' + desc1.hasOwnProperty("get"));
41 if (!desc2.hasOwnProperty("value")) {
42   throw new Test262Error('Expected desc2.hasOwnProperty("value") to be true, actually ' + desc2.hasOwnProperty("value"));
45 if (typeof desc2.get !== "undefined") {
46   throw new Test262Error('Expected typeof desc2.get === "undefined" , actually ' + typeof desc2.get);
50 verifyEqualTo(obj, "prop", 1001);
52 verifyNotWritable(obj, "prop");
54 verifyEnumerable(obj, "prop");
56 verifyConfigurable(obj, "prop");
58 reportCompare(0, 0);