3 module.exports = function (t, a) {
4 var o, o1, o2, x, y = {}, z = {};
5 o = { inherited: true };
8 o1.nonremovable = 'raz';
9 Object.defineProperty(o1, 'hidden', { value: 'hidden' });
11 o2 = Object.defineProperties({}, { nonremovable: { value: y } });
14 try { t(o2, o1); } catch (ignore) {}
16 a(o2.visible, z, "Enumerable");
17 a(o1.hidden, 'hidden', "Not Enumerable");
18 a(o2.propertyIsEnumerable('visible'), true, "Enumerable is enumerable");
19 a(o2.propertyIsEnumerable('hidden'), false,
20 "Not enumerable is not enumerable");
22 a(o2.hasOwnProperty('inherited'), false, "Extend only own");
23 a(o2.inherited, undefined, "Extend ony own: value");
25 a(o2.nonremovable, y, "Do not overwrite non configurable");
26 a(o2.other, 'other', "Own kept");
30 try { t(x, o1); } catch (ignore) {}
32 a(x.visible, z, "Enumerable");
33 a(x.hidden, 'hidden', "Not Enumerable");
34 a(x.propertyIsEnumerable('visible'), true, "Enumerable is enumerable");
35 a(x.propertyIsEnumerable('hidden'), false,
36 "Not enumerable is not enumerable");
38 a(x.hasOwnProperty('inherited'), false, "Extend only own");
39 a(x.inherited, undefined, "Extend ony own: value");
41 a(x.nonremovable, y, "Ignored non configurable");
42 a(x.other, 'other', "Other");
45 a(x.visible, 3, "Writable is writable");
49 a.throws(function () {
51 }, "Not writable is not writable");
56 a.ok(!x.hasOwnProperty('visible'), "Configurable is configurable");
60 a.throws(function () {
62 }, "Not configurable is not configurable");
64 x = Object.defineProperty({}, 'foo',
65 { configurable: false, writable: true, enumerable: false, value: 'bar' });
67 try { t(x, { foo: 'lorem' }); } catch (ignore) {}
68 a(x.foo, 'bar', "Writable, not enumerable");