Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 15.6.2.js |
michael@0 | 9 | ECMA Section: 15.6.2 The Boolean Constructor |
michael@0 | 10 | 15.6.2.1 new Boolean( value ) |
michael@0 | 11 | 15.6.2.2 new Boolean() |
michael@0 | 12 | |
michael@0 | 13 | This test verifies that the Boolean constructor |
michael@0 | 14 | initializes a new object (typeof should return |
michael@0 | 15 | "object"). The prototype of the new object should |
michael@0 | 16 | be Boolean.prototype. The value of the object |
michael@0 | 17 | should be ToBoolean( value ) (a boolean value). |
michael@0 | 18 | |
michael@0 | 19 | Description: |
michael@0 | 20 | Author: christine@netscape.com |
michael@0 | 21 | Date: june 27, 1997 |
michael@0 | 22 | |
michael@0 | 23 | */ |
michael@0 | 24 | var SECTION = "15.6.2"; |
michael@0 | 25 | var VERSION = "ECMA_1"; |
michael@0 | 26 | startTest(); |
michael@0 | 27 | var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()"; |
michael@0 | 28 | |
michael@0 | 29 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 30 | |
michael@0 | 31 | var array = new Array(); |
michael@0 | 32 | var item = 0; |
michael@0 | 33 | |
michael@0 | 34 | new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) ); |
michael@0 | 35 | new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor ); |
michael@0 | 36 | new TestCase( SECTION, |
michael@0 | 37 | "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 38 | "[object Boolean]", |
michael@0 | 39 | eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 40 | new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() ); |
michael@0 | 41 | new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) ); |
michael@0 | 42 | new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor ); |
michael@0 | 43 | new TestCase( SECTION, |
michael@0 | 44 | "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 45 | "[object Boolean]", |
michael@0 | 46 | eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 47 | new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() ); |
michael@0 | 48 | new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) ); |
michael@0 | 49 | new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor ); |
michael@0 | 50 | new TestCase( SECTION, |
michael@0 | 51 | "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 52 | "[object Boolean]", |
michael@0 | 53 | eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 54 | new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() ); |
michael@0 | 55 | new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) ); |
michael@0 | 56 | new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor ); |
michael@0 | 57 | new TestCase( SECTION, |
michael@0 | 58 | "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 59 | "[object Boolean]", |
michael@0 | 60 | eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 61 | new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() ); |
michael@0 | 62 | new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') ); |
michael@0 | 63 | new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor ); |
michael@0 | 64 | new TestCase( SECTION, |
michael@0 | 65 | "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 66 | "[object Boolean]", |
michael@0 | 67 | eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 68 | new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() ); |
michael@0 | 69 | new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') ); |
michael@0 | 70 | new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor ); |
michael@0 | 71 | new TestCase( SECTION, |
michael@0 | 72 | "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 73 | "[object Boolean]", |
michael@0 | 74 | eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 75 | new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() ); |
michael@0 | 76 | new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') ); |
michael@0 | 77 | new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor ); |
michael@0 | 78 | new TestCase( SECTION, |
michael@0 | 79 | "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 80 | "[object Boolean]", |
michael@0 | 81 | eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 82 | new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() ); |
michael@0 | 83 | new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) ); |
michael@0 | 84 | new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor ); |
michael@0 | 85 | new TestCase( SECTION, |
michael@0 | 86 | "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 87 | "[object Boolean]", |
michael@0 | 88 | eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 89 | new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() ); |
michael@0 | 90 | new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) ); |
michael@0 | 91 | new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor ); |
michael@0 | 92 | new TestCase( SECTION, |
michael@0 | 93 | "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 94 | "[object Boolean]", |
michael@0 | 95 | eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 96 | new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() ); |
michael@0 | 97 | new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) ); |
michael@0 | 98 | new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor ); |
michael@0 | 99 | new TestCase( SECTION, |
michael@0 | 100 | "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 101 | "[object Boolean]", |
michael@0 | 102 | eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 103 | new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() ); |
michael@0 | 104 | new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) ); |
michael@0 | 105 | new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor ); |
michael@0 | 106 | new TestCase( SECTION, |
michael@0 | 107 | "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 108 | "[object Boolean]", |
michael@0 | 109 | eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 110 | new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() ); |
michael@0 | 111 | new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) ); |
michael@0 | 112 | new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); |
michael@0 | 113 | new TestCase( SECTION, |
michael@0 | 114 | "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 115 | "[object Boolean]", |
michael@0 | 116 | eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 117 | new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); |
michael@0 | 118 | new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) ); |
michael@0 | 119 | new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); |
michael@0 | 120 | new TestCase( "15.6.2.2", |
michael@0 | 121 | "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", |
michael@0 | 122 | "[object Boolean]", |
michael@0 | 123 | eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); |
michael@0 | 124 | new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() ); |
michael@0 | 125 | new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() ); |
michael@0 | 126 | |
michael@0 | 127 | test(); |