1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_6/Proxy/proxy-constructNonObject.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,18 @@ 1.4 +function bogusConstruct(target) { return 4; } 1.5 +function bogusConstructUndefined(target) { } 1.6 + 1.7 +var handler = { construct: bogusConstruct } 1.8 + 1.9 +function callable() {} 1.10 + 1.11 +var p = new Proxy(callable, handler); 1.12 + 1.13 +assertThrowsInstanceOf(function () { new p(); }, TypeError, 1.14 + "[[Construct must throw if an object is not returned."); 1.15 + 1.16 +handler.construct = bogusConstructUndefined; 1.17 +assertThrowsInstanceOf(function () { new p(); }, TypeError, 1.18 + "[[Construct must throw if an object is not returned."); 1.19 + 1.20 +if (typeof reportCompare === "function") 1.21 + reportCompare(0,0, "OK");