Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / mozilla / strict / script-tests / eval-variable-environment.js
blob7337aec091ee1537e9646194e4bbcad0c0893ebb
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var code;
8 code =
9 "eval('var x = 2; typeof x');";
10 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
11 true);
13 code =
14 "eval('\"use strict\"; var x = 2; typeof x');";
15 assertEq(testLenientAndStrict(code, returns("number"), returns("number")),
16 true);
18 code =
19 "eval('var x = 2;'); " +
20 "typeof x";
21 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
22 true);
24 code =
25 "eval('\"use strict\"; var x = 2;'); " +
26 "typeof x";
27 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
28 true);
30 code =
31 "eval('\"use strict\"; var x = 2; typeof x'); " +
32 "typeof x";
33 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
34 true);
36 code =
37 "function test() " +
38 "{ " +
39 " eval('var x = 2;'); " +
40 " return typeof x; " +
41 "} " +
42 "test();";
43 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")),
44 true);
46 code =
47 "function test() " +
48 "{ " +
49 " 'use strict'; " +
50 " eval('var x = 2;'); " +
51 " return typeof x; " +
52 "} " +
53 "test();";
54 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
55 true);
57 code =
58 "function test() " +
59 "{ " +
60 " eval('\"use strict\"; var x = 2;'); " +
61 " return typeof x; " +
62 "} " +
63 "test();";
64 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")),
65 true);
67 reportCompare(true, true);
69 var successfullyParsed = true;