js/src/tests/ecma/extensions/9.9-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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: 9.9-1.js
michael@0 9 ECMA Section: 9.9 Type Conversion: ToObject
michael@0 10 Description:
michael@0 11
michael@0 12 undefined generate a runtime error
michael@0 13 null generate a runtime error
michael@0 14 boolean create a new Boolean object whose default
michael@0 15 value is the value of the boolean.
michael@0 16 number Create a new Number object whose default
michael@0 17 value is the value of the number.
michael@0 18 string Create a new String object whose default
michael@0 19 value is the value of the string.
michael@0 20 object Return the input argument (no conversion).
michael@0 21 Author: christine@netscape.com
michael@0 22 Date: 17 july 1997
michael@0 23 */
michael@0 24
michael@0 25 var VERSION = "ECMA_1";
michael@0 26 startTest();
michael@0 27 var SECTION = "9.9-1";
michael@0 28
michael@0 29 writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
michael@0 30
michael@0 31 new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
michael@0 32
michael@0 33 new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
michael@0 34
michael@0 35 new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
michael@0 36
michael@0 37 new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
michael@0 38
michael@0 39 new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
michael@0 40
michael@0 41 new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
michael@0 42
michael@0 43 new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
michael@0 44
michael@0 45 new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
michael@0 46
michael@0 47 new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
michael@0 48
michael@0 49 new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
michael@0 50
michael@0 51 new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
michael@0 52
michael@0 53 new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
michael@0 54
michael@0 55 new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
michael@0 56
michael@0 57 new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
michael@0 58
michael@0 59 new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
michael@0 60
michael@0 61 new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
michael@0 62
michael@0 63 test();
michael@0 64
michael@0 65 function MyObject( value ) {
michael@0 66 this.value = value;
michael@0 67 this.valueOf = new Function ( "return this.value" );
michael@0 68 }

mercurial