]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/string-001.js
2 File Name: string-001.js
3 Corresponds To: 15.5.4.2-2-n.js
4 ECMA Section: 15.5.4.2 String.prototype.toString()
6 Description: Returns this string value. Note that, for a String
7 object, the toString() method happens to return the same
8 thing as the valueOf() method.
10 The toString function is not generic; it generates a
11 runtime error if its this value is not a String object.
12 Therefore it connot be transferred to the other kinds of
13 objects for use as a method.
15 Author: christine@netscape.com
18 var SECTION
= "string-001";
19 var VERSION
= "JS1_4";
20 var TITLE
= "String.prototype.toString";
23 writeHeaderToLog( SECTION
+ " "+ TITLE
);
26 var testcases
= new Array();
28 var result
= "Failed";
29 var exception
= "No exception thrown";
30 var expect
= "Passed";
33 OBJECT
= new Object();
34 OBJECT
.toString
= String
.prototype.toString();
35 result
= OBJECT
.toString();
38 exception
= e
.toString();
41 testcases
[tc
++] = new TestCase(
43 "OBJECT = new Object; "+
44 " OBJECT.toString = String.prototype.toString; OBJECT.toString()" +
45 " (threw " + exception
+")",