2 File Name: number-003.js
3 Corresponds To: 15.7.4.3-3.js
4 ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
6 Returns this number value.
8 The valueOf function is not generic; it generates a runtime error if its
9 this value is not a Number object. Therefore it cannot be transferred to
10 other kinds of objects for use as a method.
12 Author: christine@netscape.com
13 Date: 16 september 1997
15 var SECTION = "number-003";
16 var VERSION = "JS1_4";
17 var TITLE = "Exceptions for Number.valueOf()";
20 var testcases = new Array();
23 writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
25 var result = "Failed";
26 var exception = "No exception thrown";
27 var expect = "Passed";
30 VALUE_OF = Number.prototype.valueOf;
31 OBJECT = new String("Infinity");
32 OBJECT.valueOf = VALUE_OF;
33 result = OBJECT.valueOf();
36 exception = e.toString();
39 testcases[tc++] = new TestCase(
41 "Assigning Number.prototype.valueOf as the valueOf of a String object " +
42 " (threw " + exception +")",