1/**
2    File Name:          string-002.js
3    Corresponds To:     15.5.4.3-3-n.js
4    ECMA Section:       15.5.4.3 String.prototype.valueOf()
5
6    Description:        Returns this string value.
7
8                        The valueOf function is not generic; it generates a
9                        runtime error if its this value is not a String object.
10                        Therefore it connot be transferred to the other kinds of
11                        objects for use as a method.
12
13    Author:             christine@netscape.com
14    Date:               1 october 1997
15*/
16    var SECTION = "string-002";
17    var VERSION = "JS1_4";
18    var TITLE   = "String.prototype.valueOf";
19
20    startTest();
21    writeHeaderToLog( SECTION + " "+ TITLE);
22
23    var tc = 0;
24    var testcases = new Array();
25
26    var result = "Failed";
27    var exception = "No exception thrown";
28    var expect = "Passed";
29
30    try {
31        var OBJECT =new Object();
32        OBJECT.valueOf = String.prototype.valueOf;
33        result = OBJECT.valueOf();
34    } catch ( e ) {
35        result = expect;
36        exception = e.toString();
37    }
38
39    testcases[tc++] = new TestCase(
40        SECTION,
41        "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
42        "result = OBJECT.valueOf();" +
43        " (threw " + exception +")",
44        expect,
45        result );
46
47    test();
48
49
50