js/src/tests/ecma_5/strict/12.10.1.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:960ebe8cf9f6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
3 /*
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
6 */
7
8 /*
9 * 'with' statements are forbidden in strict top-level code. This is
10 * eval code, but that's close enough.
11 */
12 assertEq(testLenientAndStrict('with (1) {}',
13 completesNormally,
14 raisesException(SyntaxError)),
15 true);
16
17 /* 'with' statements are forbidden in strict function code. */
18 assertEq(testLenientAndStrict('function f() { "use strict"; with (1) {} }',
19 parseRaisesException(SyntaxError),
20 parseRaisesException(SyntaxError)),
21 true);
22
23 /*
24 * A use strict directive in a function mustn't affect the strictness
25 * of subsequent code.
26 */
27 assertEq(parsesSuccessfully('function f() { "use strict"; }; with (1) {}'),
28 true);
29
30 reportCompare(true, true);

mercurial