michael@0: load(libdir + "asserts.js"); michael@0: michael@0: // Throw a TypeError if Proxy is called with less than two arguments michael@0: assertThrowsInstanceOf(function () { Proxy(); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy(); }, TypeError); michael@0: assertThrowsInstanceOf(function () { Proxy({}); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy({}); }, TypeError); michael@0: michael@0: // Throw a TypeError if the first argument is not a non-null object michael@0: assertThrowsInstanceOf(function () { Proxy(0, {}); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy(0, {}); }, TypeError); michael@0: assertThrowsInstanceOf(function () { Proxy(null, {}); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy(null, {}); }, TypeError); michael@0: michael@0: // Throw a TypeError if the second argument is not a non-null object michael@0: assertThrowsInstanceOf(function () { Proxy({}, 0); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy({}, 0); }, TypeError); michael@0: assertThrowsInstanceOf(function () { Proxy({}, null); }, TypeError); michael@0: assertThrowsInstanceOf(function () { new Proxy({}, null); }, TypeError); michael@0: michael@0: // Result of the call should be an object michael@0: assertEq(typeof Proxy({}, {}), 'object'); michael@0: assertEq(typeof new Proxy({}, {}), 'object');