michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 9.9-1.js michael@0: ECMA Section: 9.9 Type Conversion: ToObject michael@0: Description: michael@0: michael@0: undefined generate a runtime error michael@0: null generate a runtime error michael@0: boolean create a new Boolean object whose default michael@0: value is the value of the boolean. michael@0: number Create a new Number object whose default michael@0: value is the value of the number. michael@0: string Create a new String object whose default michael@0: value is the value of the string. michael@0: object Return the input argument (no conversion). michael@0: Author: christine@netscape.com michael@0: Date: 17 july 1997 michael@0: */ michael@0: michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var SECTION = "9.9-1"; michael@0: michael@0: writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); michael@0: michael@0: new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ ); michael@0: michael@0: new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); michael@0: michael@0: test(); michael@0: michael@0: function MyObject( value ) { michael@0: this.value = value; michael@0: this.valueOf = new Function ( "return this.value" ); michael@0: }