michael@0: function raisesException(exception) { michael@0: return function (code) { michael@0: eval(code); michael@0: }; michael@0: }; michael@0: function obj() { michael@0: var o = { assertEq: true, y: 1 }; michael@0: Object.defineProperty(o, 'x', { writable: false }); michael@0: return o; michael@0: } michael@0: function in_strict_with(expr) { michael@0: return "with(obj()) { (function () { 'use strict'; " + expr + " })(); }"; michael@0: } michael@0: try { assertEq(raisesException(TypeError)(in_strict_with('x++;')), true); } catch (e) {}