]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/date-001.js
60ef3a4af912541d9b0cb2eb195e94c189e4a78f
3 Corresponds To: 15.9.5.2-2.js
4 ECMA Section: 15.9.5.2 Date.prototype.toString
6 This function returns a string value. The contents of the string are
7 implementation dependent, but are intended to represent the Date in a
8 convenient, human-readable form in the current time zone.
10 The toString function is not generic; it generates a runtime error if its
11 this value is not a Date object. Therefore it cannot be transferred to
12 other kinds of objects for use as a method.
15 This verifies that calling toString on an object that is not a string
16 generates a runtime error.
18 Author: christine@netscape.com
19 Date: 12 november 1997
21 var SECTION
= "date-001";
22 var VERSION
= "JS1_4";
23 var TITLE
= "Date.prototype.toString";
26 writeHeaderToLog( SECTION
+ " "+ TITLE
);
29 var testcases
= new Array();
31 var result
= "Failed";
32 var exception
= "No exception thrown";
33 var expect
= "Passed";
36 var OBJ
= new MyObject( new Date(0) );
37 result
= OBJ
.toString();
40 exception
= e
.toString();
43 testcases
[tc
++] = new TestCase(
45 "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" +
46 " (threw " + exception
+")",
52 function MyObject( value
) {
54 this.valueOf
= new Function( "return this.value" );
55 this.toString
= Date
.prototype.toString
;