Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / immediate-constant-instead-of-cell.js
blobb3a1645c0fab9a8ae3d5ca3c1ed7f4e90a3dcae2
1 description("Test immediate constants where objects are expects. Should not crash.");
3 tests = [];
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")));
12 num=1;
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) {}