js/src/tests/ecma/ObjectObjects/15.2.1.2.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/ObjectObjects/15.2.1.2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.2.1.2.js
    1.12 +   ECMA Section:       15.2.1.2  The Object Constructor Called as a Function:
    1.13 +   Object(value)
    1.14 +   Description:        When Object is called as a function rather than as a
    1.15 +   constructor, the following steps are taken:
    1.16 +
    1.17 +   1.  If value is null or undefined, create and return a
    1.18 +   new object with no proerties other than internal
    1.19 +   properties exactly as if the object constructor
    1.20 +   had been called on that same value (15.2.2.1).
    1.21 +   2.  Return ToObject (value), whose rules are:
    1.22 +
    1.23 +   undefined   generate a runtime error
    1.24 +   null        generate a runtime error
    1.25 +   boolean     create a new Boolean object whose default
    1.26 +   value is the value of the boolean.
    1.27 +   number      Create a new Number object whose default
    1.28 +   value is the value of the number.
    1.29 +   string      Create a new String object whose default
    1.30 +   value is the value of the string.
    1.31 +   object      Return the input argument (no conversion).
    1.32 +
    1.33 +   Author:             christine@netscape.com
    1.34 +   Date:               17 july 1997
    1.35 +*/
    1.36 +
    1.37 +var SECTION = "15.2.1.2";
    1.38 +var VERSION = "ECMA_1";
    1.39 +startTest();
    1.40 +var TITLE   = "Object()";
    1.41 +
    1.42 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.43 +
    1.44 +var MYOB = Object();
    1.45 +
    1.46 +new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()",    MYOB,      MYOB.valueOf()      );
    1.47 +new TestCase( SECTION, "typeof Object()",       "object",               typeof (Object(null)) );
    1.48 +new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()",    "[object Object]",       eval("var MYOB = Object(); MYOB.toString()") );
    1.49 +
    1.50 +test();

mercurial