js/src/tests/ecma/ObjectObjects/15.2.4.3.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: 15.2.4.3.js
michael@0 9 ECMA Section: 15.2.4.3 Object.prototype.valueOf()
michael@0 10
michael@0 11 Description: As a rule, the valueOf method for an object simply
michael@0 12 returns the object; but if the object is a "wrapper"
michael@0 13 for a host object, as may perhaps be created by the
michael@0 14 Object constructor, then the contained host object
michael@0 15 should be returned.
michael@0 16
michael@0 17 This only covers native objects.
michael@0 18
michael@0 19 Author: christine@netscape.com
michael@0 20 Date: 28 october 1997
michael@0 21
michael@0 22 */
michael@0 23 var SECTION = "15.2.4.3";
michael@0 24 var VERSION = "ECMA_1";
michael@0 25 startTest();
michael@0 26 var TITLE = "Object.prototype.valueOf()";
michael@0 27
michael@0 28 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 29
michael@0 30
michael@0 31 var myarray = new Array();
michael@0 32 myarray.valueOf = Object.prototype.valueOf;
michael@0 33 var myboolean = new Boolean();
michael@0 34 myboolean.valueOf = Object.prototype.valueOf;
michael@0 35 var myfunction = new Function();
michael@0 36 myfunction.valueOf = Object.prototype.valueOf;
michael@0 37 var myobject = new Object();
michael@0 38 myobject.valueOf = Object.prototype.valueOf;
michael@0 39 var mymath = Math;
michael@0 40 mymath.valueOf = Object.prototype.valueOf;
michael@0 41 var mydate = new Date();
michael@0 42 mydate.valueOf = Object.prototype.valueOf;
michael@0 43 var mynumber = new Number();
michael@0 44 mynumber.valueOf = Object.prototype.valueOf;
michael@0 45 var mystring = new String();
michael@0 46 mystring.valueOf = Object.prototype.valueOf;
michael@0 47
michael@0 48 new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length );
michael@0 49
michael@0 50 new TestCase( SECTION,
michael@0 51 "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()",
michael@0 52 myarray,
michael@0 53 myarray.valueOf() );
michael@0 54 new TestCase( SECTION,
michael@0 55 "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()",
michael@0 56 myboolean,
michael@0 57 myboolean.valueOf() );
michael@0 58 new TestCase( SECTION,
michael@0 59 "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()",
michael@0 60 myfunction,
michael@0 61 myfunction.valueOf() );
michael@0 62 new TestCase( SECTION,
michael@0 63 "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()",
michael@0 64 myobject,
michael@0 65 myobject.valueOf() );
michael@0 66 new TestCase( SECTION,
michael@0 67 "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()",
michael@0 68 mymath,
michael@0 69 mymath.valueOf() );
michael@0 70 new TestCase( SECTION,
michael@0 71 "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()",
michael@0 72 mynumber,
michael@0 73 mynumber.valueOf() );
michael@0 74 new TestCase( SECTION,
michael@0 75 "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()",
michael@0 76 mystring,
michael@0 77 mystring.valueOf() );
michael@0 78 new TestCase( SECTION,
michael@0 79 "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()",
michael@0 80 mydate,
michael@0 81 mydate.valueOf() );
michael@0 82
michael@0 83 test();

mercurial