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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:7491c98535ca
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /**
8 File Name: 9.9-1.js
9 ECMA Section: 9.9 Type Conversion: ToObject
10 Description:
11
12 undefined generate a runtime error
13 null generate a runtime error
14 boolean create a new Boolean object whose default
15 value is the value of the boolean.
16 number Create a new Number object whose default
17 value is the value of the number.
18 string Create a new String object whose default
19 value is the value of the string.
20 object Return the input argument (no conversion).
21 Author: christine@netscape.com
22 Date: 17 july 1997
23 */
24
25 var VERSION = "ECMA_1";
26 startTest();
27 var SECTION = "9.9-1";
28
29 writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
30
31 new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
32
33 new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
34
35 new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
36
37 new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
38
39 new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
40
41 new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
42
43 new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
44
45 new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
46
47 new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
48
49 new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
50
51 new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
52
53 new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
54
55 new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
56
57 new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
58
59 new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
60
61 new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
62
63 test();
64
65 function MyObject( value ) {
66 this.value = value;
67 this.valueOf = new Function ( "return this.value" );
68 }

mercurial