michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: function make() { michael@0: var r = {}; michael@0: r.desc = {get: function() {}}; michael@0: r.a = Object.defineProperty({}, "prop", r.desc); michael@0: r.info = Object.getOwnPropertyDescriptor(r.a, "prop"); michael@0: return r; michael@0: } michael@0: michael@0: r1 = make(); michael@0: assertEq(r1.desc.get, r1.info.get); michael@0: michael@0: // Distinct evaluations of an object literal make distinct methods. michael@0: r2 = make(); michael@0: assertEq(r1.desc.get === r2.desc.get, false); michael@0: michael@0: r1.info.get.foo = 42; michael@0: michael@0: assertEq(r1.desc.get.hasOwnProperty('foo'), !r2.desc.get.hasOwnProperty('foo')); michael@0: assertEq(r1.info.get.hasOwnProperty('foo'), !r2.info.get.hasOwnProperty('foo')); michael@0: michael@0: reportCompare(0, 0, "ok");