michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: 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: /* michael@0: * 'with' statements are forbidden in strict top-level code. This is michael@0: * eval code, but that's close enough. michael@0: */ michael@0: assertEq(testLenientAndStrict('with (1) {}', michael@0: completesNormally, michael@0: raisesException(SyntaxError)), michael@0: true); michael@0: michael@0: /* 'with' statements are forbidden in strict function code. */ michael@0: assertEq(testLenientAndStrict('function f() { "use strict"; with (1) {} }', michael@0: parseRaisesException(SyntaxError), michael@0: parseRaisesException(SyntaxError)), michael@0: true); michael@0: michael@0: /* michael@0: * A use strict directive in a function mustn't affect the strictness michael@0: * of subsequent code. michael@0: */ michael@0: assertEq(parsesSuccessfully('function f() { "use strict"; }; with (1) {}'), michael@0: true); michael@0: michael@0: reportCompare(true, true);