2 File Name: number-002.js
3 Corresponds To: ecma/Number/15.7.4.3-2-n.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-002";
16 var VERSION = "JS1_4";
17 var TITLE = "Exceptions for Number.valueOf()";
20 writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
22 var testcases = new Array();
25 var result = "Failed";
26 var exception = "No exception thrown";
27 var expect = "Passed";
31 object.toString = Number.prototype.valueOf;
32 result = object.toString();
35 exception = e.toString();
38 testcases[tc++] = new TestCase(
40 "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" +
41 " (threw " + exception +")",