]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/string-002.js
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()
6 Description: Returns this string value.
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.
13 Author: christine@netscape.com
16 var SECTION
= "string-002";
17 var VERSION
= "JS1_4";
18 var TITLE
= "String.prototype.valueOf";
21 writeHeaderToLog( SECTION
+ " "+ TITLE
);
24 var testcases
= new Array();
26 var result
= "Failed";
27 var exception
= "No exception thrown";
28 var expect
= "Passed";
31 var OBJECT
=new Object();
32 OBJECT
.valueOf
= String
.prototype.valueOf
;
33 result
= OBJECT
.valueOf();
36 exception
= e
.toString();
39 testcases
[tc
++] = new TestCase(
41 "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
42 "result = OBJECT.valueOf();" +
43 " (threw " + exception
+")",