]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/Date/15.9.5.5.js
1 /* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
11 * The Original Code is Mozilla Communicator client code, released March
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
23 File Name: 15.9.5.5.js
24 ECMA Section: 15.9.5.5 Date.prototype.toLocaleString()
26 This function returns a string value. The contents of the string are
27 implementation dependent, but are intended to represent the "date"
28 portion of the Date in the current time zone in a convenient,
29 human-readable form. We can't test the content of the string,
30 but can verify that the object returned is a string.
32 The toLocaleString function is not generic; it generates a runtime error
33 if its 'this' value is not a Date object. Therefore it cannot be transferred
34 to other kinds of objects for use as a method.
36 Author: pschwartau@netscape.com
37 Date: 14 november 2000
40 var SECTION
= "15.9.5.5";
41 var VERSION
= "ECMA_3";
42 var TITLE
= "Date.prototype.toLocaleString()";
50 writeHeaderToLog( SECTION
+ " "+ TITLE
);
53 //-----------------------------------------------------------------------------------------------------
54 var testcases
= new Array();
55 //-----------------------------------------------------------------------------------------------------
58 // first, some generic tests -
60 status
= "typeof (now.toLocaleString())";
61 actual
= typeof (now
.toLocaleString());
65 status
= "Date.prototype.toLocaleString.length";
66 actual
= Date
.prototype.toLocaleString
.length
;
70 //-----------------------------------------------------------------------------------------------------
72 //-----------------------------------------------------------------------------------------------------
75 function addTestCase()
77 testcases
[tc
++] = new TestCase( SECTION
, status
, expect
, actual
);
83 for ( tc
=0; tc
< testcases
.length
; tc
++ )
85 testcases
[tc
].passed
= writeTestCaseResult(
88 testcases
[tc
].description
+ " = " + testcases
[tc
].actual
);
90 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";