1 description("Test immediate constants where objects are expects. Should not crash.");
4 function createTest(expr
) {
5 tests
.push(new Function(expr
.replace("%value%", "true")));
6 tests
.push(new Function(expr
.replace("%value%", "(-0)")));
7 tests
.push(new Function(expr
.replace("%value%", "(0)")));
8 tests
.push(new Function(expr
.replace("%value%", "(1)")));
9 tests
.push(new Function(expr
.replace("%value%", "null")));
10 tests
.push(new Function(expr
.replace("%value%", "undefined")));
13 createTest("%value% instanceof Object");
14 createTest("Object instanceof %value%");
15 createTest("%value%.toString");
16 createTest("'toString' in %value%");
17 createTest("%value% in Object");
18 createTest("num << %value%");
19 createTest("%value% << num");
20 createTest("num >> %value%");
21 createTest("%value% >> num");
22 createTest("num >>> %value%");
23 createTest("%value% >>> num");
24 createTest("num ^ %value%");
25 createTest("%value% ^ num");
26 createTest("num | %value%");
27 createTest("%value% | num");
28 createTest("num & %value%");
29 createTest("%value% & num");
30 createTest("num + %value%");
31 createTest("%value% + num");
32 createTest("num - %value%");
33 createTest("%value% - num");
34 createTest("num * %value%");
35 createTest("%value% * num");
36 createTest("num / %value%");
37 createTest("%value% / num");
38 createTest("num % %value%");
39 createTest("%value% % num");
40 createTest("num || %value%");
41 createTest("%value% || num");
42 createTest("num && %value%");
43 createTest("%value% && num");
44 createTest("%value%()");
45 createTest("%value%.toString()");
46 createTest("Object[%value%]()");
47 createTest("for(var i in %value%) { }");
48 createTest("var o = {a:1, b:2, c:3}; for(var i in o) { o = %value%; o[i]; }");
50 for (var i
= 0; i
< tests
.length
; i
++) {
51 try { tests
[i
](); } catch(e
) {}