jscript: Properly handle NULL bstr in str_to_number.
[wine/multimedia.git] / dlls / jscript / tests / lang.js
blob8f5e5d5e176bf5ffe7dfae6c14b9ef01bb1e62d2
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 tmp = eval("1");
723 ok(tmp === 1, "eval(\"1\") !== 1");
724 eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");
725 ok(tmp === 2, "tmp !== 2");
727 ok(eval(false) === false, "eval(false) !== false");
728 ok(eval() === undefined, "eval() !== undefined");
730 tmp = eval("1", "2");
731 ok(tmp === 1, "eval(\"1\", \"2\") !== 1");
733 var state = "";
734 try {
735     ok(state === "", "try: state = " + state);
736     state = "try";
737     eval("throwFunc(true);");
738 }catch(ex) {
739     ok(state === "try", "catch: state = " + state);
740     ok(ex === true, "ex is not true");
741     state = "catch";
742 }finally {
743     ok(state === "catch", "finally: state = " + state);
744     state = "finally";
746 ok(state === "finally", "state = " + state + " expected finally");
748 tmp = [,,1,2,,,true];
749 ok(tmp.length === 7, "tmp.length !== 7");
750 ok(tmp["0"] === undefined, "tmp[0] is not undefined");
751 ok(tmp["3"] === 2, "tmp[3] !== 2");
752 ok(tmp["6"] === true, "tmp[6] !== true");
753 ok(tmp[2] === 1, "tmp[2] !== 1");
755 ok([1,].length === 2, "[1,].length !== 2");
756 ok([,,].length === 3, "[,,].length !== 3");
757 ok([,].length === 2, "[].length != 2");
758 ok([].length === 0, "[].length != 0");
760 tmp = 0;
761 while(tmp < 4) {
762     ok(tmp < 4, "tmp >= 4");
763     tmp++;
765 ok(tmp === 4, "tmp !== 4");
767 tmp = 0;
768 while(true) {
769     ok(tmp < 4, "tmp >= 4");
770     tmp++;
771     if(tmp === 4) {
772         break;
773         ok(false, "break did not break");
774     }
776 ok(tmp === 4, "tmp !== 4");
778 tmp = 0;
779 do {
780     ok(tmp < 4, "tmp >= 4");
781     tmp++;
782 } while(tmp < 4);
783 ok(tmp === 4, "tmp !== 4");
785 tmp = 0;
786 do {
787     ok(tmp === 0, "tmp !=== 0");
788     tmp++;
789 } while(false);
790 ok(tmp === 1, "tmp !== 1");
792 tmp = 0;
793 do {
794     ok(tmp < 4, "tmp >= 4");
795     tmp++;
796 } while(tmp < 4)
797 ok(tmp === 4, "tmp !== 4")
799 tmp = 0;
800 while(tmp < 4) {
801     tmp++;
802     if(tmp === 2) {
803         continue;
804         ok(false, "break did not break");
805     }
806     ok(tmp <= 4 && tmp != 2, "tmp = " + tmp);
808 ok(tmp === 4, "tmp !== 4");
810 for(tmp=0; tmp < 4; tmp++)
811     ok(tmp < 4, "tmp = " + tmp);
812 ok(tmp === 4, "tmp !== 4");
814 for(tmp=0; tmp < 4; tmp++) {
815     if(tmp === 2)
816         break;
817     ok(tmp < 2, "tmp = " + tmp);
819 ok(tmp === 2, "tmp !== 2");
821 for(tmp=0; tmp < 4; tmp++) {
822     if(tmp === 2)
823         continue;
824     ok(tmp < 4 && tmp != 2, "tmp = " + tmp);
826 ok(tmp === 4, "tmp !== 4");
828 for(var fi=0; fi < 4; fi++)
829     ok(fi < 4, "fi = " + fi);
830 ok(fi === 4, "fi !== 4");
832 tmp = true;
833 obj1 = new Object();
834 for(obj1.nonexistent; tmp; tmp = false)
835     ok(!("nonexistent" in obj1), "nonexistent added to obj1");
837 obj1 = new Object();
838 for(tmp in obj1.nonexistent)
839     ok(false, "for(tmp in obj1.nonexistent) called with tmp = " + tmp);
840 ok(!("nonexistent" in obj1), "nonexistent added to obj1 by for..in loop");
843 var i, j;
845 /* Previous versions have broken finally block implementation */
846 if(ScriptEngineMinorVersion() >= 8) {
847     tmp = "";
848     i = 0;
849     while(true) {
850         tmp += "1";
851         for(i = 1; i < 3; i++) {
852             switch(i) {
853             case 1:
854                 tmp += "2";
855                 continue;
856             case 2:
857                 tmp += "3";
858                 try {
859                     throw null;
860                 }finally {
861                     tmp += "4";
862                     break;
863                 }
864             default:
865                 ok(false, "unexpected state");
866             }
867             tmp += "5";
868         }
869         with({prop: "6"}) {
870             tmp += prop;
871             break;
872         }
873     }
874     ok(tmp === "123456", "tmp = " + tmp);
877 tmp = "";
878 i = 0;
879 for(j in [1,2,3]) {
880     tmp += "1";
881     for(;;) {
882         with({prop: "2"}) {
883             tmp += prop;
884             try {
885                 throw "3";
886             }catch(e) {
887                 tmp += e;
888                 with([0])
889                     break;
890             }
891         }
892         ok(false, "unexpected state");
893     }
894     while(true) {
895         tmp += "4";
896         break;
897     }
898     break;
900 ok(tmp === "1234", "tmp = " + tmp);
902 tmp = 0;
903 for(var iter in [1,2,3]) {
904     tmp += +iter;
905     continue;
907 ok(tmp === 3, "tmp = " + tmp);
909 tmp = false;
910 for(var iter in [1,2,3]) {
911     switch(+iter) {
912     case 1:
913         tmp = true;
914         try {
915             continue;
916         }finally {}
917     default:
918         continue;
919     }
921 ok(tmp, "tmp = " + tmp);
923 loop_label:
924 while(true) {
925     while(true)
926         break loop_label;
929 loop_label: {
930     tmp = 0;
931     while(true) {
932         while(true)
933             break loop_label;
934     }
935     ok(false, "unexpected evaluation 1");
938 while(true) {
939     some_label: break;
940     ok(false, "unexpected evaluation 2");
943 just_label: tmp = 1;
944 ok(tmp === 1, "tmp != 1");
946 some_label: break some_label;
948 other_label: {
949     break other_label;
950     ok(false, "unexpected evaluation 3");
953 loop_label:
954 do {
955     while(true)
956         continue loop_label;
957 }while(false);
959 loop_label:
960 for(i = 0; i < 3; i++) {
961     while(true)
962         continue loop_label;
965 loop_label:
966 other_label:
967 for(i = 0; i < 3; i++) {
968     while(true)
969         continue loop_label;
972 loop_label:
973 for(tmp in {prop: false}) {
974     while(true)
975         continue loop_label;
978 ok((void 1) === undefined, "(void 1) !== undefined");
980 var inobj = new Object();
982 for(var iter in inobj)
983     ok(false, "unexpected iter = " + iter);
985 inobj.test = true;
986 tmp = 0;
987 for(iter in inobj) {
988     ok(iter == "test", "unexpected iter = " + iter);
989     tmp++;
991 ok(tmp === 1, "for..in tmp = " + tmp);
993 function forinTestObj() {}
995 forinTestObj.prototype.test3 = true;
997 var arr = new Array();
998 inobj = new forinTestObj();
999 inobj.test1 = true;
1000 inobj.test2 = true;
1002 tmp = 0;
1003 for(iter in inobj) {
1004     arr[iter] = true;
1005     tmp++;
1008 ok(tmp === 3, "for..in tmp = " + tmp);
1009 ok(arr["test1"] === true, "arr[test1] !== true");
1010 ok(arr["test2"] === true, "arr[test2] !== true");
1011 ok(arr["test3"] === true, "arr[test3] !== true");
1013 tmp = new Object();
1014 tmp.test = false;
1015 ok((delete tmp.test) === true, "delete returned false");
1016 ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
1017 ok(!("test" in tmp), "test is still in tmp after delete?");
1018 for(iter in tmp)
1019     ok(false, "tmp has prop " + iter);
1021 tmp = new Object();
1022 tmp.test = false;
1023 ok((delete tmp["test"]) === true, "delete returned false");
1024 ok(typeof(tmp.test) === "undefined", "tmp.test type = " + typeof(tmp.test));
1025 ok(!("test" in tmp), "test is still in tmp after delete?");
1027 tmp.testWith = true;
1028 with(tmp)
1029     ok(testWith === true, "testWith !== true");
1031 if(false) {
1032     var varTest1 = true;
1035 ok(varTest1 === undefined, "varTest1 = " + varTest1);
1036 ok(varTest2 === undefined, "varTest2 = " + varTest1);
1038 var varTest2;
1040 function varTestFunc(varTest3) {
1041     var varTest3;
1043     ok(varTest3 === 3, "varTest3 = " + varTest3);
1044     ok(varTest4 === undefined, "varTest4 = " + varTest4);
1046     var varTest4;
1049 varTestFunc(3);
1051 deleteTest = 1;
1052 delete deleteTest;
1053 try {
1054     tmp = deleteTest;
1055     ok(false, "deleteTest not throwed exception?");
1056 }catch(ex) {}
1058 if (false)
1059     if (true)
1060         ok(false, "if evaluated");
1061     else
1062         ok(false, "else should be associated with nearest if statement");
1064 if (true)
1065     if (false)
1066         ok(false, "if evaluated");
1067     else
1068         ok(true, "else should be associated with nearest if statement");
1070 function instanceOfTest() {}
1071 tmp = new instanceOfTest();
1073 ok((tmp instanceof instanceOfTest) === true, "tmp is not instance of instanceOfTest");
1074 ok((tmp instanceof Object) === true, "tmp is not instance of Object");
1075 ok((tmp instanceof String) === false, "tmp is instance of String");
1077 instanceOfTest.prototype = new Object();
1078 ok((tmp instanceof instanceOfTest) === false, "tmp is instance of instanceOfTest");
1079 ok((tmp instanceof Object) === true, "tmp is not instance of Object");
1081 ok((1 instanceof Object) === false, "1 is instance of Object");
1082 ok((false instanceof Boolean) === false, "false is instance of Boolean");
1083 ok(("" instanceof Object) === false, "'' is instance of Object");
1085 (function () {
1086     ok((arguments instanceof Object) === true, "argument is not instance of Object");
1087     ok((arguments instanceof Array) === false, "argument is not instance of Array");
1088     ok(arguments.toString() === "[object Object]", "arguments.toString() = " + arguments.toString());
1089 })(1,2);
1091 obj = new String();
1092 ok(("length" in obj) === true, "length is not in obj");
1093 ok(("isPrototypeOf" in obj) === true, "isPrototypeOf is not in obj");
1094 ok(("abc" in obj) === false, "test is in obj");
1095 obj.abc = 1;
1096 ok(("abc" in obj) === true, "test is not in obj");
1097 ok(("1" in obj) === false, "1 is in obj");
1099 obj = [1,2,3];
1100 ok((1 in obj) === true, "1 is not in obj");
1102 obj = new Object();
1103 try {
1104     obj.prop["test"];
1105     ok(false, "expected exception");
1106 }catch(e) {}
1107 ok(!("prop" in obj), "prop in obj");
1109 ok(isNaN(NaN) === true, "isNaN(NaN) !== true");
1110 ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
1111 ok(isNaN(Infinity) === false, "isNaN(Infinity) !== false");
1112 ok(isNaN() === true, "isNaN() !== true");
1113 ok(isNaN(NaN, 0) === true, "isNaN(NaN, 0) !== true");
1114 ok(isNaN(0.5, NaN) === false, "isNaN(0.5, NaN) !== false");
1115 ok(isNaN(+undefined) === true, "isNaN(+undefined) !== true");
1117 ok(isFinite(0.5) === true, "isFinite(0.5) !== true");
1118 ok(isFinite(Infinity) === false, "isFinite(Infinity) !== false");
1119 ok(isFinite(-Infinity) === false, "isFinite(Infinity) !== false");
1120 ok(isFinite(NaN) === false, "isFinite(NaN) !== false");
1121 ok(isFinite(0.5, NaN) === true, "isFinite(0.5, NaN) !== true");
1122 ok(isFinite(NaN, 0.5) === false, "isFinite(NaN, 0.5) !== false");
1123 ok(isFinite() === false, "isFinite() !== false");
1125 ok((1 < NaN) === false, "(1 < NaN) !== false");
1126 ok((1 > NaN) === false, "(1 > NaN) !== false");
1127 ok((1 <= NaN) === false, "(1 <= NaN) !== false");
1128 ok((1 >= NaN) === false, "(1 >= NaN) !== false");
1129 ok((NaN < 1) === false, "(NaN < 1) !== false");
1130 ok((NaN > 1) === false, "(NaN > 1) !== false");
1131 ok((NaN <= 1) === false, "(NaN <= 1) !== false");
1132 ok((NaN >= 1) === false, "(NaN >= 1) !== false");
1133 ok((Infinity < 2) === false, "(Infinity < 2) !== false");
1134 ok((Infinity > 2) === true, "(Infinity > 2) !== true");
1135 ok((-Infinity < 2) === true, "(-Infinity < 2) !== true");
1137 ok(isNaN(+"test") === true, "isNaN(+'test') !== true");
1138 ok(isNaN(+"123t") === true, "isNaN(+'123t') !== true");
1139 ok(isNaN(+"Infinity x") === true, "isNaN(+'Infinity x') !== true");
1140 ok(+"Infinity" === Infinity, "+'Infinity' !== Infinity");
1141 ok(+" Infinity " === Infinity, "+' Infinity ' !== Infinity");
1142 ok(+"-Infinity" === -Infinity, "+'-Infinity' !== -Infinity");
1144 ok((NaN !== NaN) === true, "(NaN !== NaN) !== true");
1145 ok((NaN === NaN) === false, "(NaN === NaN) !== false");
1146 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
1147 ok((Infinity !== NaN) === true, "(Infinity !== NaN) !== true");
1148 ok((0 === NaN) === false, "(0 === NaN) !== false");
1150 ok((NaN != NaN) === true, "(NaN !== NaN) != true");
1151 ok((NaN == NaN) === false, "(NaN === NaN) != false");
1152 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
1153 ok((Infinity != NaN) === true, "(Infinity != NaN) !== true");
1154 ok((0 == NaN) === false, "(0 === NaN) != false");
1156 // escape tests
1157 var escapeTests = [
1158     ["\'", "\\'", 39],
1159     ["\"", "\\\"", 34],
1160     ["\\", "\\\\", 92],
1161     ["\b", "\\b", 8],
1162     ["\t", "\\t", 9],
1163     ["\n", "\\n", 10],
1164     ["\v", "\\v", 118],
1165     ["\f", "\\f", 12],
1166     ["\r", "\\r", 13],
1167     ["\xf3", "\\xf3", 0xf3],
1168     ["\u1234", "\\u1234", 0x1234],
1169     ["\a", "\\a", 97],
1170     ["\?", "\\?", 63]
1173 for(i=0; i<escapeTests.length; i++) {
1174     tmp = escapeTests[i][0].charCodeAt(0);
1175     ok(tmp === escapeTests[i][2], "escaped '" + escapeTests[i][1] + "' = " + tmp + " expected " + escapeTests[i][2]);
1178 tmp = !+"\v1";
1179 ok(tmp === true, '!+"\v1" = ' + tmp);
1181 ok(typeof(testFunc2) === "function", "typeof(testFunc2) = " + typeof(testFunc2));
1182 tmp = testFunc2(1);
1183 ok(tmp === 2, "testFunc2(1) = " + tmp);
1184 function testFunc2(x) { return x+1; }
1186 ok(typeof(testFunc3) === "function", "typeof(testFunc3) = " + typeof(testFunc3));
1187 tmp = testFunc3(1);
1188 ok(tmp === 3, "testFunc3(1) = " + tmp);
1189 tmp = function testFunc3(x) { return x+2; };
1191 tmp = testFunc4(1);
1192 ok(tmp === 5, "testFunc4(1) = " + tmp);
1193 tmp = function testFunc4(x) { return x+3; };
1194 tmp = testFunc4(1);
1195 testFunc4 = 1;
1196 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
1197 ok(tmp === 5, "testFunc4(1) = " + tmp);
1198 tmp = function testFunc4(x) { return x+4; };
1199 ok(testFunc4 === 1, "testFunc4 = " + testFunc4);
1201 function testEmbededFunctions() {
1202     ok(typeof(testFunc5) === "function", "typeof(testFunc5) = " + typeof(testFunc5));
1203     tmp = testFunc5(1);
1204     ok(tmp === 3, "testFunc5(1) = " + tmp);
1205     tmp = function testFunc5(x) { return x+2; };
1207     tmp = testFunc6(1);
1208     ok(tmp === 5, "testFunc6(1) = " + tmp);
1209     tmp = function testFunc6(x) { return x+3; };
1210     tmp = testFunc6(1);
1211     ok(tmp === 5, "testFunc6(1) = " + tmp);
1212     tmp = function testFunc6(x) { return x+4; };
1213     testFunc6 = 1;
1214     ok(testFunc6 === 1, "testFunc4 = " + testFunc6);
1217 testEmbededFunctions();
1219 date = new Date();
1220 date.toString = function() { return "toString"; }
1221 ok(""+date === "toString", "''+date = " + date);
1222 date.toString = function() { return this; }
1223 ok(""+date === ""+date.valueOf(), "''+date = " + date);
1225 str = new String("test");
1226 str.valueOf = function() { return "valueOf"; }
1227 ok(""+str === "valueOf", "''+str = " + str);
1228 str.valueOf = function() { return new Date(); }
1229 ok(""+str === "test", "''+str = " + str);
1231 ok((function (){return 1;})() === 1, "(function (){return 1;})() = " + (function (){return 1;})());
1233 var re = /=(\?|%3F)/g;
1234 ok(re.source === "=(\\?|%3F)", "re.source = " + re.source);
1236 tmp = new Array();
1237 for(var i=0; i<2; i++)
1238     tmp[i] = /b/;
1239 ok(tmp[0] != tmp[1], "tmp[0] == tmp [1]");
1241 ok(isNullBSTR(getNullBSTR()), "isNullBSTR(getNullBSTR()) failed\n");
1242 ok(getNullBSTR() === '', "getNullBSTR() !== ''");
1243 ok(+getNullBSTR() === 0 , "+getNullBTR() !=== 0");
1245 ok(getVT(nullDisp) === "VT_DISPATCH", "getVT(nullDisp) = " + getVT(nullDisp));
1246 ok(typeof(nullDisp) === "object", "typeof(nullDisp) = " + typeof(nullDisp));
1247 ok(nullDisp === nullDisp, "nullDisp !== nullDisp");
1248 ok(nullDisp !== re, "nullDisp === re");
1249 ok(nullDisp === null, "nullDisp === null");
1250 ok(nullDisp == null, "nullDisp == null");
1251 ok(getVT(true && nullDisp) === "VT_DISPATCH",
1252    "getVT(0 && nullDisp) = " + getVT(true && nullDisp));
1253 ok(!nullDisp === true, "!nullDisp = " + !nullDisp);
1254 ok(String(nullDisp) === "null", "String(nullDisp) = " + String(nullDisp));
1255 ok(nullDisp != new Object(), "nullDisp == new Object()");
1256 ok(new Object() != nullDisp, "new Object() == nullDisp");
1257 ok((typeof Object(nullDisp)) === "object", "typeof Object(nullDisp) !== 'object'");
1258 tmp = getVT(Object(nullDisp));
1259 ok(tmp === "VT_DISPATCH", "getVT(Object(nullDisp) = " + tmp);
1260 tmp = Object(nullDisp).toString();
1261 ok(tmp === "[object Object]", "Object(nullDisp).toString() = " + tmp);
1263 function do_test() {}
1264 function nosemicolon() {} nosemicolon();
1265 function () {} nosemicolon();
1267 if(false) {
1268     function in_if_false() { return true; } ok(false, "!?");
1271 ok(in_if_false(), "in_if_false failed");
1273 (function() { newValue = 1; })();
1274 ok(newValue === 1, "newValue = " + newValue);
1276 obj = {undefined: 3};
1278 ok(typeof(name_override_func) === "function", "typeof(name_override_func) = " + typeof(name_override_func));
1279 name_override_func = 3;
1280 ok(name_override_func === 3, "name_override_func = " + name_override_func);
1281 function name_override_func() {};
1282 ok(name_override_func === 3, "name_override_func = " + name_override_func);
1284 /* Keep this test in the end of file */
1285 undefined = 6;
1286 ok(undefined === 6, "undefined = " + undefined);
1288 NaN = 6;
1289 ok(NaN === 6, "NaN !== 6");
1291 Infinity = 6;
1292 ok(Infinity === 6, "Infinity !== 6");
1294 Math = 6;
1295 ok(Math === 6, "NaN !== 6");
1297 reportSuccess();