Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / mozilla / strict / script-tests / 11.4.1.js
blobdf84762d562f73eab6bec3cc1cfa53c873298ad8
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /*
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
6 */
8 /* Deleting an identifier is a syntax error in strict mode code only. */
9 assertEq(testLenientAndStrict('delete x;',
10 parsesSuccessfully,
11 parseRaisesException(SyntaxError)),
12 true);
15 * A reference expression surrounded by parens is itself a reference
16 * expression.
18 assertEq(testLenientAndStrict('delete (x);',
19 parsesSuccessfully,
20 parseRaisesException(SyntaxError)),
21 true);
23 /* Deleting other sorts of expressions are not syntax errors in either mode. */
24 assertEq(testLenientAndStrict('delete x.y;',
25 parsesSuccessfully,
26 parsesSuccessfully),
27 true);
29 /* Functions should inherit the surrounding code's strictness. */
30 assertEq(testLenientAndStrict('function f() { delete x; }',
31 parsesSuccessfully,
32 parseRaisesException(SyntaxError)),
33 true);
35 /* Local directives override the surrounding code's strictness. */
36 assertEq(testLenientAndStrict('function f() { "use strict"; delete x; }',
37 parseRaisesException(SyntaxError),
38 parseRaisesException(SyntaxError)),
39 true);
41 reportCompare(true, true);
43 var successfullyParsed = true;