|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/licenses/publicdomain/ |
|
4 */ |
|
5 |
|
6 var code; |
|
7 |
|
8 code = |
|
9 "eval('var x = 2; typeof x');"; |
|
10 assertEq(testLenientAndStrict(code, returns("number"), returns("number")), |
|
11 true); |
|
12 |
|
13 code = |
|
14 "eval('\"use strict\"; var x = 2; typeof x');"; |
|
15 assertEq(testLenientAndStrict(code, returns("number"), returns("number")), |
|
16 true); |
|
17 |
|
18 code = |
|
19 "eval('var x = 2;'); " + |
|
20 "typeof x"; |
|
21 assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")), |
|
22 true); |
|
23 |
|
24 code = |
|
25 "eval('\"use strict\"; var x = 2;'); " + |
|
26 "typeof x"; |
|
27 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), |
|
28 true); |
|
29 |
|
30 code = |
|
31 "eval('\"use strict\"; var x = 2; typeof x'); " + |
|
32 "typeof x"; |
|
33 assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), |
|
34 true); |
|
35 |
|
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); |
|
45 |
|
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); |
|
56 |
|
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); |
|
66 |
|
67 reportCompare(true, true); |