quartz: COM cleanup for IAMFilterMiscFlags in VideoRenderer.
[wine/multimedia.git] / dlls / jscript / tests / lang.js
blob308e0c9d31c4057f32c7cc558686a7384ba9fb26
1 /*
2  * Copyright 2008 Jacek Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
19 var tmp;
21 ok(true, "true is not true?");
22 ok(!false, "!false is not true");
23 ok(!undefined, "!undefined is not true");
24 ok(!null, "!null is not true");
25 ok(!0, "!0 is not true");
26 ok(!0.0, "!0.0 is not true");
28 ok(1 === 1, "1 === 1 is false");
29 ok(!(1 === 2), "!(1 === 2) is false");
30 ok(1.0 === 1, "1.0 === 1 is false");
31 ok("abc" === "abc", "\"abc\" === \"abc\" is false");
32 ok(true === true, "true === true is false");
33 ok(null === null, "null === null is false");
34 ok(undefined === undefined, "undefined === undefined is false");
35 ok(!(undefined === null), "!(undefined === null) is false");
36 ok(1E0 === 1, "1E0 === 1 is false");
37 ok(1000000*1000000 === 1000000000000, "1000000*1000000 === 1000000000000 is false");
38 ok(8.64e15 === 8640000000000000, "8.64e15 !== 8640000000000000");
39 ok(1e2147483648 === Infinity, "1e2147483648 !== Infinity");
41 ok(1 !== 2, "1 !== 2 is false");
42 ok(null !== undefined, "null !== undefined is false");
44 ok(1 == 1, "1 == 1 is false");
45 ok(!(1 == 2), "!(1 == 2) is false");
46 ok(1.0 == 1, "1.0 == 1 is false");
47 ok("abc" == "abc", "\"abc\" == \"abc\" is false");
48 ok(true == true, "true == true is false");
49 ok(null == null, "null == null is false");
50 ok(undefined == undefined, "undefined == undefined is false");
51 ok(undefined == null, "undefined == null is false");
52 ok(true == 1, "true == 1 is false");
53 ok(!(true == 2), "true == 2");
54 ok(0 == false, "0 == false is false");
56 ok(1 != 2, "1 != 2 is false");
57 ok(false != 1, "false != 1 is false");
59 var trueVar = true;
60 ok(trueVar, "trueVar is not true");
62 ok(ScriptEngine.length === 0, "ScriptEngine.length is not 0");
64 function testFunc1(x, y) {
65     ok(this !== undefined, "this is undefined");
66     ok(x === true, "x is not true");
67     ok(y === "test", "y is not \"test\"");
68     ok(arguments.length === 2, "arguments.length is not 2");
69     ok(arguments["0"] === true, "arguments[0] is not true");
70     ok(arguments["1"] === "test", "arguments[1] is not \"test\"");
71     ok(arguments.callee === testFunc1, "arguments.calee !== testFunc1");
72     ok(testFunc1.arguments === arguments, "testFunc1.arguments = " + testFunc1.arguments);
74     return true;
77 ok(testFunc1.length === 2, "testFunc1.length is not 2");
78 ok(testFunc1.arguments === null, "testFunc1.arguments = " + testFunc1.arguments);
80 ok(Object.prototype !== undefined, "Object.prototype is undefined");
81 ok(Object.prototype.prototype === undefined, "Object.prototype is not undefined");
82 ok(String.prototype !== undefined, "String.prototype is undefined");
83 ok(Array.prototype !== undefined, "Array.prototype is undefined");
84 ok(Boolean.prototype !== undefined, "Boolean.prototype is undefined");
85 ok(Number.prototype !== undefined, "Number.prototype is undefined");
86 ok(RegExp.prototype !== undefined, "RegExp.prototype is undefined");
87 ok(Math !== undefined, "Math is undefined");
88 ok(Math.prototype === undefined, "Math.prototype is not undefined");
89 ok(Function.prototype !== undefined, "Function.prototype is undefined");
90 ok(Function.prototype.prototype === undefined, "Function.prototype.prototype is not undefined");
91 ok(Date.prototype !== undefined, "Date.prototype is undefined");
92 ok(Date.prototype.prototype === undefined, "Date.prototype is not undefined");
94 Function.prototype.test = true;
95 ok(testFunc1.test === true, "testFunc1.test !== true");
96 ok(Function.test === true, "Function.test !== true");
98 ok(typeof(0) === "number", "typeof(0) is not number");
99 ok(typeof(1.5) === "number", "typeof(1.5) is not number");
100 ok(typeof("abc") === "string", "typeof(\"abc\") is not string");
101 ok(typeof("") === "string", "typeof(\"\") is not string");
102 ok(typeof(true) === "boolean", "typeof(true) is not boolean");
103 ok(typeof(null) === "object", "typeof(null) is not object");
104 ok(typeof(undefined) === "undefined", "typeof(undefined) is not undefined");
105 ok(typeof(Math) === "object", "typeof(Math) is not object");
106 ok(typeof(String.prototype) === "object", "typeof(String.prototype) is not object");
107 ok(typeof(testFunc1) === "function", "typeof(testFunc1) is not function");
108 ok(typeof(String) === "function", "typeof(String) is not function");
109 ok(typeof(ScriptEngine) === "function", "typeof(ScriptEngine) is not function");
110 ok(typeof(this) === "object", "typeof(this) is not object");
111 ok(typeof(doesnotexist) === "undefined", "typeof(doesnotexist) = " + typeof(doesnotexist));
112 tmp = typeof((new Object()).doesnotexist);
113 ok(tmp === "undefined", "typeof((new Object).doesnotexist = " + tmp);
114 tmp = typeof(testObj.onlyDispID);
115 ok(tmp === "unknown", "typeof(testObj.onlyDispID) = " + tmp);
117 ok(testFunc1(true, "test") === true, "testFunc1 not returned true");
119 ok(testFunc1.arguments === null, "testFunc1.arguments = " + testFunc1.arguments);
121 (tmp) = 3;
122 ok(tmp === 3, "tmp = " + tmp);
124 function testRecFunc(x) {
125     ok(testRecFunc.arguments === arguments, "testRecFunc.arguments = " + testRecFunc.arguments);
126     if(x) {
127         testRecFunc(false);
128         ok(testRecFunc.arguments === arguments, "testRecFunc.arguments = " + testRecFunc.arguments);
129         ok(testRecFunc.arguments[0] === true, "testRecFunc.arguments.x = " + testRecFunc.arguments[0]);
130     }
133 testRecFunc.arguments = 5;
134 ok(testRecFunc.arguments === null, "testRecFunc.arguments = " + testRecFunc.arguments);
135 testRecFunc(true);
136 ok(testRecFunc.arguments === null, "testRecFunc.arguments = " + testRecFunc.arguments);
138 tmp = (function() {1;})();
139 ok(tmp === undefined, "tmp = " + tmp);
140 tmp = eval("1;");
141 ok(tmp === 1, "tmp = " + tmp);
142 tmp = eval("1,2;");
143 ok(tmp === 2, "tmp = " + tmp);
144 tmp = eval("if(true) {3}");
145 ok(tmp === 3, "tmp = " + tmp);
147 var obj1 = new Object();
148 ok(typeof(obj1) === "object", "typeof(obj1) is not object");
149 ok(obj1.constructor === Object, "unexpected obj1.constructor");
150 obj1.test = true;
151 obj1.func = function () {
152     ok(this === obj1, "this is not obj1");
153     ok(this.test === true, "this.test is not true");
154     ok(arguments.length === 1, "arguments.length is not 1");
155     ok(arguments["0"] === true, "arguments[0] is not true");
156     ok(typeof(arguments.callee) === "function", "typeof(arguments.calee) = " + typeof(arguments.calee));
158     return "test";
161 ok(obj1.func(true) === "test", "obj1.func(true) is not \"test\"");
163 function testConstr1() {
164     this.var1 = 1;
166     ok(this !== undefined, "this is undefined");
167     ok(arguments.length === 1, "arguments.length is not 1");
168     ok(arguments["0"] === true, "arguments[0] is not 1");
169     ok(arguments.callee === testConstr1, "arguments.calee !== testConstr1");
171     return false;
174 testConstr1.prototype.pvar = 1;
176 var obj2 = new testConstr1(true);
177 ok(typeof(obj2) === "object", "typeof(obj2) is not object");
178 ok(obj2.constructor === testConstr1, "unexpected obj2.constructor");
179 ok(obj2.pvar === 1, "obj2.pvar is not 1");
181 testConstr1.prototype.pvar = 2;
182 ok(obj2.pvar === 2, "obj2.pvar is not 2");
184 obj2.pvar = 3;
185 testConstr1.prototype.pvar = 1;
186 ok(obj2.pvar === 3, "obj2.pvar is not 3");
188 obj1 = new Object();
189 function testConstr3() {
190     return obj1;
193 obj2 = new testConstr3();
194 ok(obj1 === obj2, "obj1 != obj2");
196 function testConstr4() {
197     return 2;
200 obj2 = new testConstr3();
201 ok(typeof(obj2) === "object", "typeof(obj2) = " + typeof(obj2));
203 var obj3 = new Object;
204 ok(typeof(obj3) === "object", "typeof(obj3) is not object");
206 for(var iter in "test")
207     ok(false, "unexpected forin call, test = " + iter);
209 for(var iter in null)
210     ok(false, "unexpected forin call, test = " + iter);
212 for(var iter in false)
213     ok(false, "unexpected forin call, test = " + iter);
215 for(var iter in pureDisp)
216     ok(false, "unexpected forin call in pureDisp object");
218 tmp = new Object();
219 ok(!tmp.nonexistent, "!tmp.nonexistent = " + !tmp.nonexistent);
220 ok(!("nonexistent" in tmp), "nonexistent is in tmp after '!' expression")
222 tmp = new Object();
223 ok((~tmp.nonexistent) === -1, "!tmp.nonexistent = " + ~tmp.nonexistent);
224 ok(!("nonexistent" in tmp), "nonexistent is in tmp after '~' expression")
226 tmp = new Object();
227 ok(isNaN(+tmp.nonexistent), "!tmp.nonexistent = " + (+tmp.nonexistent));
228 ok(!("nonexistent" in tmp), "nonexistent is in tmp after '+' expression")
230 tmp = new Object();
231 tmp[tmp.nonexistent];
232 ok(!("nonexistent" in tmp), "nonexistent is in tmp after array expression")
234 tmp = 0;
235 if(true)
236     tmp = 1;
237 else
238     ok(false, "else evaluated");
239 ok(tmp === 1, "tmp !== 1, if not evaluated?");
241 tmp = 0;
242 if(1 === 0)
243     ok(false, "if evaluated");
244 else
245     tmp = 1;
246 ok(tmp === 1, "tmp !== 1, if not evaluated?");
248 if(false)
249     ok(false, "if(false) evaluated");
251 tmp = 0;
252 if(true)
253     tmp = 1;
254 ok(tmp === 1, "tmp !== 1, if(true) not evaluated?");
256 if(false) {
257 }else {
260 var obj3 = { prop1: 1,  prop2: typeof(false) };
261 ok(obj3.prop1 === 1, "obj3.prop1 is not 1");
262 ok(obj3.prop2 === "boolean", "obj3.prop2 is not \"boolean\"");
263 ok(obj3.constructor === Object, "unexpected obj3.constructor");
266     var blockVar = 1;
267     blockVar = 2;
269 ok(blockVar === 2, "blockVar !== 2");
271 ok((true ? 1 : 2) === 1, "conditional expression true is not 1");
272 ok((0 === 2 ? 1 : 2) === 2, "conditional expression true is not 2");
274 ok(getVT(undefined) === "VT_EMPTY", "getVT(undefined) is not VT_EMPTY");
275 ok(getVT(null) === "VT_NULL", "getVT(null) is not VT_NULL");
276 ok(getVT(0) === "VT_I4", "getVT(0) is not VT_I4");
277 ok(getVT(0.5) === "VT_R8", "getVT(0.5) is not VT_R8");
278 ok(getVT("test") === "VT_BSTR", "getVT(\"test\") is not VT_BSTR");
279 ok(getVT(Math) === "VT_DISPATCH", "getVT(Math) is not VT_DISPATCH");
280 ok(getVT(false) === "VT_BOOL", "getVT(false) is not VT_BOOL");
282 tmp = 2+2;
283 ok(tmp === 4, "2+2 !== 4");
284 ok(getVT(tmp) === "VT_I4", "getVT(2+2) !== VT_I4");
286 tmp = 2+2.5;
287 ok(tmp === 4.5, "2+2.5 !== 4.5");
288 ok(getVT(tmp) === "VT_R8", "getVT(2+2.5) !== VT_R8");
290 tmp = 1.5+2.5;
291 ok(tmp === 4, "1.4+2.5 !== 4");
292 ok(getVT(tmp) === "VT_I4", "getVT(1.5+2.5) !== VT_I4");
294 tmp = 4-2;
295 ok(tmp === 2, "4-2 !== 2");
296 ok(getVT(tmp) === "VT_I4", "getVT(4-2) !== VT_I4");
298 tmp = 4.5-2;
299 ok(tmp === 2.5, "4.5-2 !== 2.5");
300 ok(getVT(tmp) === "VT_R8", "getVT(4.5-2) !== VT_R8");
302 tmp = -2;
303 ok(tmp === 0-2, "-2 !== 0-2");
304 ok(getVT(tmp) === "VT_I4", "getVT(-2) !== VT_I4");
306 tmp = 2*3;
307 ok(tmp === 6, "2*3 !== 6");
308 ok(getVT(tmp) === "VT_I4", "getVT(2*3) !== VT_I4");
310 tmp = 2*3.5;
311 ok(tmp === 7, "2*3.5 !== 7");
312 ok(getVT(tmp) === "VT_I4", "getVT(2*3.5) !== VT_I4");
314 tmp = 2.5*3.5;
315 /* FIXME: the parser loses precision */
316 /* ok(tmp === 8.75, "2.5*3.5 !== 8.75"); */
317 ok(tmp > 8.749999 && tmp < 8.750001, "2.5*3.5 !== 8.75");
318 ok(getVT(tmp) === "VT_R8", "getVT(2.5*3.5) !== VT_R8");
320 tmp = 4/2;
321 ok(tmp === 2, "4/2 !== 2");
322 ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4");
324 tmp = 4.5/1.5;
325 ok(tmp === 3, "4.5/1.5 !== 3");
326 ok(getVT(tmp) === "VT_I4", "getVT(4.5/1.5) !== VT_I4");
328 tmp = 3/2;
329 ok(tmp === 1.5, "3/2 !== 1.5");
330 ok(getVT(tmp) === "VT_R8", "getVT(3/2) !== VT_R8");
332 tmp = 3%2;
333 ok(tmp === 1, "3%2 = " + tmp);
335 tmp = 4%2;
336 ok(tmp ===0, "4%2 = " + tmp);
338 tmp = 3.5%1.5;
339 ok(tmp === 0.5, "3.5%1.5 = " + tmp);
341 tmp = 3%true;
342 ok(tmp === 0, "3%true = " + tmp);
344 tmp = "ab" + "cd";
345 ok(tmp === "abcd", "\"ab\" + \"cd\" !== \"abcd\"");
347 tmp = 1;
348 ok((tmp += 1) === 2, "tmp += 1 !== 2");
349 ok(tmp === 2, "tmp !== 2");
351 tmp = 2;
352 ok((tmp -= 1) === 1, "tmp -= 1 !== 1");
353 ok(tmp === 1, "tmp !=== 1");
355 tmp = 2;
356 ok((tmp *= 1.5) === 3, "tmp *= 1.5 !== 3");
357 ok(tmp === 3, "tmp !=== 3");
359 tmp = 5;
360 ok((tmp /= 2) === 2.5, "tmp /= 2 !== 2.5");
361 ok(tmp === 2.5, "tmp !=== 2.5");
363 tmp = 3;
364 ok((tmp %= 2) === 1, "tmp %= 2 !== 1");
365 ok(tmp === 1, "tmp !== 1");
367 tmp = 8;
368 ok((tmp <<= 1) === 16, "tmp <<= 1 !== 16");
370 tmp = 8;
371 ok((tmp >>= 1) === 4, "tmp >>= 1 !== 4");
373 tmp = 8;
374 ok((tmp >>>= 1) === 4, "tmp >>>= 1 !== 4");
376 tmp = 3 || ok(false, "second or expression called");
377 ok(tmp === 3, "3 || (...) is not 3");
379 tmp = false || 2;
380 ok(tmp === 2, "false || 2 is not 2");
382 tmp = 0 && ok(false, "second and expression called");
383 ok(tmp === 0, "0 && (...) is not 0");
385 tmp = true && "test";
386 ok(tmp === "test", "true && \"test\" is not \"test\"");
388 tmp = true && 0;
389 ok(tmp === 0, "true && 0 is not 0");
391 tmp = 3 | 4;
392 ok(tmp === 7, "3 | 4 !== 7");
393 ok(getVT(tmp) === "VT_I4", "getVT(3|4) = " + getVT(tmp));
395 tmp = 3.5 | 0;
396 ok(tmp === 3, "3.5 | 0 !== 3");
397 ok(getVT(tmp) === "VT_I4", "getVT(3.5|0) = " + getVT(tmp));
399 tmp = -3.5 | 0;
400 ok(tmp === -3, "-3.5 | 0 !== -3");
401 ok(getVT(tmp) === "VT_I4", "getVT(3.5|0) = " + getVT(tmp));
403 tmp = 0 | NaN;
404 ok(tmp === 0, "0 | NaN = " + tmp);
406 tmp = 0 | Infinity;
407 ok(tmp === 0, "0 | NaN = " + tmp);
409 tmp = 0 | (-Infinity);
410 ok(tmp === 0, "0 | NaN = " + tmp);
412 tmp = 10;
413 ok((tmp |= 0x10) === 26, "tmp(10) |= 0x10 !== 26");
414 ok(getVT(tmp) === "VT_I4", "getVT(tmp |= 10) = " + getVT(tmp));
416 tmp = 3 & 5;
417 ok(tmp === 1, "3 & 5 !== 1");
418 ok(getVT(tmp) === "VT_I4", "getVT(3|5) = " + getVT(tmp));
420 tmp = 3.5 & 0xffff;
421 ok(tmp === 3, "3.5 & 0xffff !== 3 ");
422 ok(getVT(tmp) === "VT_I4", "getVT(3.5&0xffff) = " + getVT(tmp));
424 tmp = (-3.5) & 0xffffffff;
425 ok(tmp === -3, "-3.5 & 0xffff !== -3");
426 ok(getVT(tmp) === "VT_I4", "getVT(3.5&0xffff) = " + getVT(tmp));
428 tmp = 2 << 3;
429 ok(tmp === 16, "2 << 3 = " + tmp);
431 tmp = 2 << 35;
432 ok(tmp === 16, "2 << 35 = " + tmp);
434 tmp = 8 >> 2;
435 ok(tmp === 2, "8 >> 2 = " + tmp);
437 tmp = -64 >> 4;
438 ok(tmp === -4, "-64 >> 4 = " + tmp);
440 tmp = 8 >>> 2;
441 ok(tmp === 2, "8 >> 2 = " + tmp);
443 tmp = -64 >>> 4;
444 ok(tmp === 0x0ffffffc, "-64 >>> 4 = " + tmp);
446 tmp = 4 >>> NaN;
447 ok(tmp === 4, "4 >>> NaN = " + tmp);
449 tmp = 10;
450 ok((tmp &= 8) === 8, "tmp(10) &= 8 !== 8");
451 ok(getVT(tmp) === "VT_I4", "getVT(tmp &= 8) = " + getVT(tmp));
453 tmp = 0xf0f0^0xff00;
454 ok(tmp === 0x0ff0, "0xf0f0^0xff00 !== 0x0ff0");
455 ok(getVT(tmp) === "VT_I4", "getVT(0xf0f0^0xff00) = " + getVT(tmp));
457 tmp = 5;
458 ok((tmp ^= 3) === 6, "tmp(5) ^= 3 !== 6");
459 ok(getVT(tmp) === "VT_I4", "getVT(tmp ^= 3) = " + getVT(tmp));
461 tmp = ~1;
462 ok(tmp === -2, "~1 !== -2");
463 ok(getVT(tmp) === "VT_I4", "getVT(~1) = " + getVT(tmp));
465 ok((3,4) === 4, "(3,4) !== 4");
467 ok(+3 === 3, "+3 !== 3");
468 ok(+true === 1, "+true !== 1");
469 ok(+false === 0, "+false !== 0");
470 ok(+null === 0, "+null !== 0");
471 ok(+"0" === 0, "+'0' !== 0");
472 ok(+"3" === 3, "+'3' !== 3");
473 ok(+"-3" === -3, "+'-3' !== -3");
474 ok(+"0xff" === 255, "+'0xff' !== 255");
475 ok(+"3e3" === 3000, "+'3e3' !== 3000");
477 tmp = new Number(1);
478 ok(+tmp === 1, "+(new Number(1)) = " + (+tmp));
479 ok(tmp.constructor === Number, "unexpected tmp.constructor");
480 tmp = new String("1");
481 ok(+tmp === 1, "+(new String('1')) = " + (+tmp));
482 ok(tmp.constructor === String, "unexpected tmp.constructor");
484 ok("" + 0 === "0", "\"\" + 0 !== \"0\"");
485 ok("" + 123 === "123", "\"\" + 123 !== \"123\"");
486 ok("" + (-5) === "-5", "\"\" + (-5) !== \"-5\"");
487 ok("" + null === "null", "\"\" + null !== \"null\"");
488 ok("" + undefined === "undefined", "\"\" + undefined !== \"undefined\"");
489 ok("" + true === "true", "\"\" + true !== \"true\"");
490 ok("" + false === "false", "\"\" + false !== \"false\"");
491 ok("" + 0.5 === "0.5", "'' + 0.5 = " + 0.5);
492 ok("" + (-0.5432) === "-0.5432", "'' + (-0.5432) = " + (-0.5432));
494 ok(1 < 3.4, "1 < 3.4 failed");
495 ok(!(3.4 < 1), "3.4 < 1");
496 ok("abc" < "abcd", "abc < abcd failed");
497 ok("abcd" < "abce", "abce < abce failed");
498 ok("" < "x", "\"\" < \"x\" failed");
499 ok(!(0 < 0), "0 < 0");
501 ok(1 <= 3.4, "1 <= 3.4 failed");
502 ok(!(3.4 <= 1), "3.4 <= 1");
503 ok("abc" <= "abcd", "abc <= abcd failed");
504 ok("abcd" <= "abce", "abce <= abce failed");
505 ok("" <= "x", "\"\" <= \"x\" failed");
506 ok(0 <= 0, "0 <= 0 failed");
508 ok(3.4 > 1, "3.4 > 1 failed");
509 ok(!(1 > 3.4), "1 > 3.4");
510 ok("abcd" > "abc", "abc > abcd failed");
511 ok("abce" > "abcd", "abce > abce failed");
512 ok("x" > "", "\"x\" > \"\" failed");
513 ok(!(0 > 0), "0 > 0");
515 ok(3.4 >= 1, "3.4 >= 1 failed");
516 ok(!(1 >= 3.4), "1 >= 3.4");
517 ok("abcd" >= "abc", "abc >= abcd failed");
518 ok("abce" >= "abcd", "abce >= abce failed");
519 ok("x" >= "", "\"x\" >= \"\" failed");
520 ok(0 >= 0, "0 >= 0");
522 tmp = 1;
523 ok(++tmp === 2, "++tmp (1) is not 2");
524 ok(tmp === 2, "incremented tmp is not 2");
525 ok(--tmp === 1, "--tmp (2) is not 1");
526 ok(tmp === 1, "decremented tmp is not 1");
527 ok(tmp++ === 1, "tmp++ (1) is not 1");
528 ok(tmp === 2, "incremented tmp(1) is not 2");
529 ok(tmp-- === 2, "tmp-- (2) is not 2");
530 ok(tmp === 1, "decremented tmp is not 1");
532 tmp = new Object();
533 tmp.iii++;
534 ok(isNaN(tmp.iii), "tmp.iii = " + tmp.iii);
536 String.prototype.test = true;
537 ok("".test === true, "\"\".test is not true");
539 Boolean.prototype.test = true;
540 ok(true.test === true, "true.test is not true");
542 Number.prototype.test = true;
543 ok((0).test === true, "(0).test is not true");
544 ok((0.5).test === true, "(0.5).test is not true");
546 var state = "";
547 try {
548     ok(state === "", "try: state = " + state);
549     state = "try";
550 }catch(ex) {
551     ok(false, "unexpected catch");
553 ok(state === "try", "state = " + state + " expected try");
555 state = "";
556 try {
557     ok(state === "", "try: state = " + state);
558     state = "try";
559 }finally {
560     ok(state === "try", "finally: state = " + state);
561     state = "finally";
563 ok(state === "finally", "state = " + state + " expected finally");
565 state = "";
566 try {
567     try {
568         throw 0;
569     }finally {
570         state = "finally";
571     }
572 }catch(e) {
573     ok(state === "finally", "state = " + state + " expected finally");
574     state = "catch";
576 ok(state === "catch", "state = " + state + " expected catch");
578 try {
579     try {
580         throw 0;
581     }finally {
582         throw 1;
583     }
584 }catch(e) {
585     ok(e === 1, "e = " + e);
588 state = "";
589 try {
590     ok(state === "", "try: state = " + state);
591     state = "try";
592 }catch(ex) {
593     ok(false, "unexpected catch");
594 }finally {
595     ok(state === "try", "finally: state = " + state);
596     state = "finally";
598 ok(state === "finally", "state = " + state + " expected finally");
600 var state = "";
601 try {
602     ok(state === "", "try: state = " + state);
603     state = "try";
604     throw "except";
605 }catch(ex) {
606     ok(state === "try", "catch: state = " + state);
607     ok(ex === "except", "ex is not \"except\"");
608     state = "catch";
610 ok(state === "catch", "state = " + state + " expected catch");
612 var state = "";
613 try {
614     ok(state === "", "try: state = " + state);
615     state = "try";
616     throw true;
617 }catch(ex) {
618     ok(state === "try", "catch: state = " + state);
619     ok(ex === true, "ex is not true");
620     state = "catch";
621 }finally {
622     ok(state === "catch", "finally: state = " + state);
623     state = "finally";
625 ok(state === "finally", "state = " + state + " expected finally");
627 var state = "";
628 try {
629     ok(state === "", "try: state = " + state);
630     state = "try";
631     try { throw true; } finally {}
632 }catch(ex) {
633     ok(state === "try", "catch: state = " + state);
634     ok(ex === true, "ex is not true");
635     state = "catch";
636 }finally {
637     ok(state === "catch", "finally: state = " + state);
638     state = "finally";
640 ok(state === "finally", "state = " + state + " expected finally");
642 var state = "";
643 try {
644     ok(state === "", "try: state = " + state);
645     state = "try";
646     try { throw "except"; } catch(ex) { throw true; }
647 }catch(ex) {
648     ok(state === "try", "catch: state = " + state);
649     ok(ex === true, "ex is not true");
650     state = "catch";
651 }finally {
652     ok(state === "catch", "finally: state = " + state);
653     state = "finally";
655 ok(state === "finally", "state = " + state + " expected finally");
657 function throwFunc(x) {
658     throw x;
661 var state = "";
662 try {
663     ok(state === "", "try: state = " + state);
664     state = "try";
665     throwFunc(true);
666 }catch(ex) {
667     ok(state === "try", "catch: state = " + state);
668     ok(ex === true, "ex is not true");
669     state = "catch";
670 }finally {
671     ok(state === "catch", "finally: state = " + state);
672     state = "finally";
674 ok(state === "finally", "state = " + state + " expected finally");
676 state = "";
677 switch(1) {
678 case "1":
679     ok(false, "unexpected case \"1\"");
680 case 1:
681     ok(state === "", "case 1: state = " + state);
682     state = "1";
683 default:
684     ok(state === "1", "default: state = " + state);
685     state = "default";
686 case false:
687     ok(state === "default", "case false: state = " + state);
688     state = "false";
690 ok(state === "false", "state = " + state);
692 state = "";
693 switch("") {
694 case "1":
695 case 1:
696     ok(false, "unexpected case 1");
697 default:
698     ok(state === "", "default: state = " + state);
699     state = "default";
700 case false:
701     ok(state === "default", "case false: state = " + state);
702     state = "false";
704 ok(state === "false", "state = " + state);
706 state = "";
707 switch(1) {
708 case "1":
709     ok(false, "unexpected case \"1\"");
710 case 1:
711     ok(state === "", "case 1: state = " + state);
712     state = "1";
713 default:
714     ok(state === "1", "default: state = " + state);
715     state = "default";
716     break;
717 case false:
718     ok(false, "unexpected case false");
720 ok(state === "default", "state = " + state);
722 switch(1) {
723 case 2:
724     ok(false, "unexpected case 2");
725 case 3:
726     ok(false, "unexpected case 3");
729 (function() {
730     var i=0;
732     switch(1) {
733     case 1:
734         i++;
735     }
736     return i;
737 })();
739 tmp = eval("1");
740 ok(tmp === 1, "eval(\"1\") !== 1");
741 eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");
742 ok(tmp === 2, "tmp !== 2");
744 ok(eval(false) === false, "eval(false) !== false");
745 ok(eval() === undefined, "eval() !== undefined");
747 tmp = eval("1", "2");
748 ok(tmp === 1, "eval(\"1\", \"2\") !== 1");
750 var state = "";
751 try {
752     ok(state === "", "try: state = " + state);
753     state = "try";
754     eval("throwFunc(true);");
755 }catch(ex) {
756     ok(state === "try", "catch: state = " + state);
757     ok(ex === true, "ex is not true");
758     state = "catch";
759 }finally {
760     ok(state === "catch", "finally: state = " + state);
761     state = "finally";
763 ok(state === "finally", "state = " + state + " expected finally");
765 tmp = [,,1,2,,,true];
766 ok(tmp.length === 7, "tmp.length !== 7");
767 ok(tmp["0"] === undefined, "tmp[0] is not undefined");
768 ok(tmp["3"] === 2, "tmp[3] !== 2");
769 ok(tmp["6"] === true, "tmp[6] !== true");
770 ok(tmp[2] === 1, "tmp[2] !== 1");
772 ok([1,].length === 2, "[1,].length !== 2");
773 ok([,,].length === 3, "[,,].length !== 3");
774 ok([,].length === 2, "[].length != 2");
775 ok([].length === 0, "[].length != 0");
777 tmp = 0;
778 while(tmp < 4) {
779     ok(tmp < 4, "tmp >= 4");
780     tmp++;
782 ok(tmp === 4, "tmp !== 4");
784 tmp = 0;
785 while(true) {
786     ok(tmp < 4, "tmp >= 4");
787     tmp++;
788     if(tmp === 4) {
789         break;
790         ok(false, "break did not break");
791     }
793 ok(tmp === 4, "tmp !== 4");
795 tmp = 0;
796 do {
797     ok(tmp < 4, "tmp >= 4");
798     tmp++;
799 } while(tmp < 4);
800 ok(tmp === 4, "tmp !== 4");
802 tmp = 0;
803 do {
804     ok(tmp === 0, "tmp !=== 0");
805     tmp++;
806 } while(false);
807 ok(tmp === 1, "tmp !== 1");
809 tmp = 0;
810 do {
811     ok(tmp < 4, "tmp >= 4");
812     tmp++;
813 } while(tmp < 4)
814 ok(tmp === 4, "tmp !== 4")
816 tmp = 0;
817 while(tmp < 4) {
818     tmp++;
819     if(tmp === 2) {
820         continue;
821         ok(false, "break did not break");
822     }
823     ok(tmp <= 4 && tmp != 2, "tmp = " + tmp);
825 ok(tmp === 4, "tmp !== 4");
827 for(tmp=0; tmp < 4; tmp++)
828     ok(tmp < 4, "tmp = " + tmp);
829 ok(tmp === 4, "tmp !== 4");
831 for(tmp=0; tmp < 4; tmp++) {
832     if(tmp === 2)
833         break;
834     ok(tmp < 2, "tmp = " + tmp);
836 ok(tmp === 2, "tmp !== 2");
838 for(tmp=0; tmp < 4; tmp++) {
839     if(tmp === 2)
840         continue;
841     ok(tmp < 4 && tmp != 2, "tmp = " + tmp);
843 ok(tmp === 4, "tmp !== 4");
845 for(var fi=0; fi < 4; fi++)
846     ok(fi < 4, "fi = " + fi);
847 ok(fi === 4, "fi !== 4");
849 tmp = true;
850 obj1 = new Object();
851 for(obj1.nonexistent; tmp; tmp = false)
852     ok(!("nonexistent" in obj1), "nonexistent added to obj1");
854 obj1 = new Object();
855 for(tmp in obj1.nonexistent)
856     ok(false, "for(tmp in obj1.nonexistent) called with tmp = " + tmp);
857 ok(!("nonexistent" in obj1), "nonexistent added to obj1 by for..in loop");
860 var i, j;
862 /* Previous versions have broken finally block implementation */
863 if(ScriptEngineMinorVersion() >= 8) {
864     tmp = "";
865     i = 0;
866     while(true) {
867         tmp += "1";
868         for(i = 1; i < 3; i++) {
869             switch(i) {
870             case 1:
871                 tmp += "2";
872                 continue;
873             case 2:
874                 tmp += "3";
875                 try {
876                     throw null;
877                 }finally {
878                     tmp += "4";
879                     break;
880                 }
881             default:
882                 ok(false, "unexpected state");
883             }
884             tmp += "5";
885         }
886         with({prop: "6"}) {
887             tmp += prop;
888             break;
889         }
890     }
891     ok(tmp === "123456", "tmp = " + tmp);
894 tmp = "";
895 i = 0;
896 for(j in [1,2,3]) {
897     tmp += "1";
898     for(;;) {
899         with({prop: "2"}) {
900             tmp += prop;
901             try {
902                 throw "3";
903             }catch(e) {
904                 tmp += e;
905                 with([0])
906                     break;
907             }
908         }
909         ok(false, "unexpected state");
910     }
911     while(true) {
912         tmp += "4";
913         break;
914     }
915     break;
917 ok(tmp === "1234", "tmp = " + tmp);
919 tmp = 0;
920 for(var iter in [1,2,3]) {
921     tmp += +iter;
922     continue;
924 ok(tmp === 3, "tmp = " + tmp);
926 tmp = false;
927 for(var iter in [1,2,3]) {
928     switch(+iter) {
929     case 1:
930         tmp = true;
931         try {
932             continue;
933         }finally {}
934     default:
935         continue;
936     }
938 ok(tmp, "tmp = " + tmp);
940 loop_label:
941 while(true) {
942     while(true)
943         break loop_label;
946 loop_label: {
947     tmp = 0;
948     while(true) {
949         while(true)
950             break loop_label;
951     }
952     ok(false, "unexpected evaluation 1");
955 while(true) {
956     some_label: break;
957     ok(false, "unexpected evaluation 2");
960 just_label: tmp = 1;
961 ok(tmp === 1, "tmp != 1");
963 some_label: break some_label;
965 other_label: {
966     break other_label;
967     ok(false, "unexpected evaluation 3");
970 loop_label:
971 do {
972     while(true)
973         continue loop_label;
974 }while(false);
976 loop_label:
977 for(i = 0; i < 3; i++) {
978     while(true)
979         continue loop_label;
982 loop_label:
983 other_label:
984 for(i = 0; i < 3; i++) {
985     while(true)
986         continue loop_label;
989 loop_label:
990 for(tmp in {prop: false}) {
991     while(true)
992         continue loop_label;
995 ok((void 1) === undefined, "(void 1) !== undefined");
997 var inobj = new Object();
999 for(var iter in inobj)
1000     ok(false, "unexpected iter = " + iter);
1002 inobj.test = true;
1003 tmp = 0;
1004 for(iter in inobj) {
1005     ok(iter == "test", "unexpected iter = " + iter);
1006     tmp++;
1008 ok(tmp === 1, "for..in tmp = " + tmp);
1010 function forinTestObj() {}
1012 forinTestObj.prototype.test3 = true;
1014 var arr = new Array();
1015 inobj = new forinTestObj();
1016 inobj.test1 = true;
1017 inobj.test2 = true;
1019 tmp = 0;
1020 for(iter in inobj) {
1021     arr[iter] = true;
1022     tmp++;
1025 ok(tmp === 3, "for..in tmp = " + tmp);
1026 ok(arr["test1"] === true, "arr[test1] !== true");
1027 ok(arr["test2"] === true, "arr[test2] !== true");
1028 ok(arr["test3"] === true, "arr[test3] !== true");
1030 tmp = new Object();
1031 tmp.test = false;
1032 ok((delete tmp.test) === true, "delete returned false");
1033 ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
1034 ok(!("test" in tmp), "test is still in tmp after delete?");
1035 for(iter in tmp)
1036     ok(false, "tmp has prop " + iter);
1038 tmp = new Object();
1039 tmp.test = false;
1040 ok((delete tmp["test"]) === true, "delete returned false");
1041 ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
1042 ok(!("test" in tmp), "test is still in tmp after delete?");
1044 tmp.testWith = true;
1045 with(tmp)
1046     ok(testWith === true, "testWith !== true");
1048 if(false) {
1049     var varTest1 = true;
1052 ok(varTest1 === undefined, "varTest1 = " + varTest1);
1053 ok(varTest2 === undefined, "varTest2 = " + varTest1);
1055 var varTest2;
1057 function varTestFunc(varTest3) {
1058     var varTest3;
1060     ok(varTest3 === 3, "varTest3 = " + varTest3);
1061     ok(varTest4 === undefined, "varTest4 = " + varTest4);
1063     var varTest4;
1066 varTestFunc(3);
1068 deleteTest = 1;
1069 delete deleteTest;
1070 try {
1071     tmp = deleteTest;
1072     ok(false, "deleteTest not throwed exception?");
1073 }catch(ex) {}
1075 if (false)
1076     if (true)
1077         ok(false, "if evaluated");
1078     else
1079         ok(false, "else should be associated with nearest if statement");
1081 if (true)
1082     if (false)
1083         ok(false, "if evaluated");
1084     else
1085         ok(true, "else should be associated with nearest if statement");
1087 function instanceOfTest() {}
1088 tmp = new instanceOfTest();
1090 ok((tmp instanceof instanceOfTest) === true, "tmp is not instance of instanceOfTest");
1091 ok((tmp instanceof Object) === true, "tmp is not instance of Object");
1092 ok((tmp instanceof String) === false, "tmp is instance of String");
1094 instanceOfTest.prototype = new Object();
1095 ok((tmp instanceof instanceOfTest) === false, "tmp is instance of instanceOfTest");
1096 ok((tmp instanceof Object) === true, "tmp is not instance of Object");
1098 ok((1 instanceof Object) === false, "1 is instance of Object");
1099 ok((false instanceof Boolean) === false, "false is instance of Boolean");
1100 ok(("" instanceof Object) === false, "'' is instance of Object");
1102 (function () {
1103     ok((arguments instanceof Object) === true, "argument is not instance of Object");
1104     ok((arguments instanceof Array) === false, "argument is not instance of Array");
1105     ok(arguments.toString() === "[object Object]", "arguments.toString() = " + arguments.toString());
1106 })(1,2);
1108 obj = new String();
1109 ok(("length" in obj) === true, "length is not in obj");
1110 ok(("isPrototypeOf" in obj) === true, "isPrototypeOf is not in obj");
1111 ok(("abc" in obj) === false, "test is in obj");
1112 obj.abc = 1;
1113 ok(("abc" in obj) === true, "test is not in obj");
1114 ok(("1" in obj) === false, "1 is in obj");
1116 obj = [1,2,3];
1117 ok((1 in obj) === true, "1 is not in obj");
1119 obj = new Object();
1120 try {
1121     obj.prop["test"];
1122     ok(false, "expected exception");
1123 }catch(e) {}
1124 ok(!("prop" in obj), "prop in obj");
1126 ok(isNaN(NaN) === true, "isNaN(NaN) !== true");
1127 ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
1128 ok(isNaN(Infinity) === false, "isNaN(Infinity) !== false");
1129 ok(isNaN() === true, "isNaN() !== true");
1130 ok(isNaN(NaN, 0) === true, "isNaN(NaN, 0) !== true");
1131 ok(isNaN(0.5, NaN) === false, "isNaN(0.5, NaN) !== false");
1132 ok(isNaN(+undefined) === true, "isNaN(+undefined) !== true");
1134 ok(isFinite(0.5) === true, "isFinite(0.5) !== true");
1135 ok(isFinite(Infinity) === false, "isFinite(Infinity) !== false");
1136 ok(isFinite(-Infinity) === false, "isFinite(Infinity) !== false");
1137 ok(isFinite(NaN) === false, "isFinite(NaN) !== false");
1138 ok(isFinite(0.5, NaN) === true, "isFinite(0.5, NaN) !== true");
1139 ok(isFinite(NaN, 0.5) === false, "isFinite(NaN, 0.5) !== false");
1140 ok(isFinite() === false, "isFinite() !== false");
1142 ok((1 < NaN) === false, "(1 < NaN) !== false");
1143 ok((1 > NaN) === false, "(1 > NaN) !== false");
1144 ok((1 <= NaN) === false, "(1 <= NaN) !== false");
1145 ok((1 >= NaN) === false, "(1 >= NaN) !== false");
1146 ok((NaN < 1) === false, "(NaN < 1) !== false");
1147 ok((NaN > 1) === false, "(NaN > 1) !== false");
1148 ok((NaN <= 1) === false, "(NaN <= 1) !== false");
1149 ok((NaN >= 1) === false, "(NaN >= 1) !== false");
1150 ok((Infinity < 2) === false, "(Infinity < 2) !== false");
1151 ok((Infinity > 2) === true, "(Infinity > 2) !== true");
1152 ok((-Infinity < 2) === true, "(-Infinity < 2) !== true");
1154 ok(isNaN(+"test") === true, "isNaN(+'test') !== true");
1155 ok(isNaN(+"123t") === true, "isNaN(+'123t') !== true");
1156 ok(isNaN(+"Infinity x") === true, "isNaN(+'Infinity x') !== true");
1157 ok(+"Infinity" === Infinity, "+'Infinity' !== Infinity");
1158 ok(+" Infinity " === Infinity, "+' Infinity ' !== Infinity");
1159 ok(+"-Infinity" === -Infinity, "+'-Infinity' !== -Infinity");
1161 ok((NaN !== NaN) === true, "(NaN !== NaN) !== true");
1162 ok((NaN === NaN) === false, "(NaN === NaN) !== false");
1163 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
1164 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
1165 ok((0 === NaN) === false, "(0 === NaN) !== false");
1167 ok((NaN != NaN) === true, "(NaN !== NaN) != true");
1168 ok((NaN == NaN) === false, "(NaN === NaN) != false");
1169 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
1170 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
1171 ok((0 == NaN) === false, "(0 === NaN) != false");
1173 // escape tests
1174 var escapeTests = [
1175     ["\'", "\\'", 39],
1176     ["\"", "\\\"", 34],
1177     ["\\", "\\\\", 92],
1178     ["\b", "\\b", 8],
1179     ["\t", "\\t", 9],
1180     ["\n", "\\n", 10],
1181     ["\v", "\\v", 118],
1182     ["\f", "\\f", 12],
1183     ["\r", "\\r", 13],
1184     ["\xf3", "\\xf3", 0xf3],
1185     ["\u1234", "\\u1234", 0x1234],
1186     ["\a", "\\a", 97],
1187     ["\?", "\\?", 63]
1190 for(i=0; i<escapeTests.length; i++) {
1191     tmp = escapeTests[i][0].charCodeAt(0);
1192     ok(tmp === escapeTests[i][2], "escaped '" + escapeTests[i][1] + "' = " + tmp + " expected " + escapeTests[i][2]);
1195 tmp = !+"\v1";
1196 ok(tmp === true, '!+"\v1" = ' + tmp);
1198 ok(typeof(testFunc2) === "function", "typeof(testFunc2) = " + typeof(testFunc2));
1199 tmp = testFunc2(1);
1200 ok(tmp === 2, "testFunc2(1) = " + tmp);
1201 function testFunc2(x) { return x+1; }
1203 ok(typeof(testFunc3) === "function", "typeof(testFunc3) = " + typeof(testFunc3));
1204 tmp = testFunc3(1);
1205 ok(tmp === 3, "testFunc3(1) = " + tmp);
1206 tmp = function testFunc3(x) { return x+2; };
1208 tmp = testFunc4(1);
1209 ok(tmp === 5, "testFunc4(1) = " + tmp);
1210 tmp = function testFunc4(x) { return x+3; };
1211 tmp = testFunc4(1);
1212 testFunc4 = 1;
1213 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
1214 ok(tmp === 5, "testFunc4(1) = " + tmp);
1215 tmp = function testFunc4(x) { return x+4; };
1216 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
1218 function testEmbeddedFunctions() {
1219     ok(typeof(testFunc5) === "function", "typeof(testFunc5) = " + typeof(testFunc5));
1220     tmp = testFunc5(1);
1221     ok(tmp === 3, "testFunc5(1) = " + tmp);
1222     tmp = function testFunc5(x) { return x+2; };
1224     tmp = testFunc6(1);
1225     ok(tmp === 5, "testFunc6(1) = " + tmp);
1226     tmp = function testFunc6(x) { return x+3; };
1227     tmp = testFunc6(1);
1228     ok(tmp === 5, "testFunc6(1) = " + tmp);
1229     tmp = function testFunc6(x) { return x+4; };
1230     testFunc6 = 1;
1231     ok(testFunc6 === 1, "testFunc4 = " + testFunc6);
1234 testEmbeddedFunctions();
1236 date = new Date();
1237 date.toString = function() { return "toString"; }
1238 ok(""+date === "toString", "''+date = " + date);
1239 date.toString = function() { return this; }
1240 ok(""+date === ""+date.valueOf(), "''+date = " + date);
1242 str = new String("test");
1243 str.valueOf = function() { return "valueOf"; }
1244 ok(""+str === "valueOf", "''+str = " + str);
1245 str.valueOf = function() { return new Date(); }
1246 ok(""+str === "test", "''+str = " + str);
1248 ok((function (){return 1;})() === 1, "(function (){return 1;})() = " + (function (){return 1;})());
1250 var re = /=(\?|%3F)/g;
1251 ok(re.source === "=(\\?|%3F)", "re.source = " + re.source);
1253 tmp = new Array();
1254 for(var i=0; i<2; i++)
1255     tmp[i] = /b/;
1256 ok(tmp[0] != tmp[1], "tmp[0] == tmp [1]");
1258 ok(isNullBSTR(getNullBSTR()), "isNullBSTR(getNullBSTR()) failed\n");
1259 ok(getNullBSTR() === '', "getNullBSTR() !== ''");
1260 ok(+getNullBSTR() === 0 , "+getNullBTR() !=== 0");
1262 ok(getVT(nullDisp) === "VT_DISPATCH", "getVT(nullDisp) = " + getVT(nullDisp));
1263 ok(typeof(nullDisp) === "object", "typeof(nullDisp) = " + typeof(nullDisp));
1264 ok(nullDisp === nullDisp, "nullDisp !== nullDisp");
1265 ok(nullDisp !== re, "nullDisp === re");
1266 ok(nullDisp === null, "nullDisp === null");
1267 ok(nullDisp == null, "nullDisp == null");
1268 ok(getVT(true && nullDisp) === "VT_DISPATCH",
1269    "getVT(0 && nullDisp) = " + getVT(true && nullDisp));
1270 ok(!nullDisp === true, "!nullDisp = " + !nullDisp);
1271 ok(String(nullDisp) === "null", "String(nullDisp) = " + String(nullDisp));
1272 ok(nullDisp != new Object(), "nullDisp == new Object()");
1273 ok(new Object() != nullDisp, "new Object() == nullDisp");
1274 ok((typeof Object(nullDisp)) === "object", "typeof Object(nullDisp) !== 'object'");
1275 tmp = getVT(Object(nullDisp));
1276 ok(tmp === "VT_DISPATCH", "getVT(Object(nullDisp) = " + tmp);
1277 tmp = Object(nullDisp).toString();
1278 ok(tmp === "[object Object]", "Object(nullDisp).toString() = " + tmp);
1280 function do_test() {}
1281 function nosemicolon() {} nosemicolon();
1282 function () {} nosemicolon();
1284 if(false) {
1285     function in_if_false() { return true; } ok(false, "!?");
1288 ok(in_if_false(), "in_if_false failed");
1290 (function() { newValue = 1; })();
1291 ok(newValue === 1, "newValue = " + newValue);
1293 obj = {undefined: 3};
1295 ok(typeof(name_override_func) === "function", "typeof(name_override_func) = " + typeof(name_override_func));
1296 name_override_func = 3;
1297 ok(name_override_func === 3, "name_override_func = " + name_override_func);
1298 function name_override_func() {};
1299 ok(name_override_func === 3, "name_override_func = " + name_override_func);
1301 /* Keep this test in the end of file */
1302 undefined = 6;
1303 ok(undefined === 6, "undefined = " + undefined);
1305 NaN = 6;
1306 ok(NaN === 6, "NaN !== 6");
1308 Infinity = 6;
1309 ok(Infinity === 6, "Infinity !== 6");
1311 Math = 6;
1312 ok(Math === 6, "NaN !== 6");
1314 reportSuccess();