]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_3/Date/15.9.5.5.js
JavaScriptCore-461.tar.gz
[apple/javascriptcore.git] / 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/
5 *
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.
10 *
11 * The Original Code is Mozilla Communicator client code, released March
12 * 31, 1998.
13 *
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
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 */
22 /**
23 File Name: 15.9.5.5.js
24 ECMA Section: 15.9.5.5 Date.prototype.toLocaleString()
25 Description:
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.
31
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.
35
36 Author: pschwartau@netscape.com
37 Date: 14 november 2000
38 */
39
40 var SECTION = "15.9.5.5";
41 var VERSION = "ECMA_3";
42 var TITLE = "Date.prototype.toLocaleString()";
43
44 var status = '';
45 var actual = '';
46 var expect = '';
47
48
49 startTest();
50 writeHeaderToLog( SECTION + " "+ TITLE);
51
52
53 //-----------------------------------------------------------------------------------------------------
54 var testcases = new Array();
55 //-----------------------------------------------------------------------------------------------------
56
57
58 // first, some generic tests -
59
60 status = "typeof (now.toLocaleString())";
61 actual = typeof (now.toLocaleString());
62 expect = "string";
63 addTestCase();
64
65 status = "Date.prototype.toLocaleString.length";
66 actual = Date.prototype.toLocaleString.length;
67 expect = 0;
68 addTestCase();
69
70 //-----------------------------------------------------------------------------------------------------
71 test();
72 //-----------------------------------------------------------------------------------------------------
73
74
75 function addTestCase()
76 {
77 testcases[tc++] = new TestCase( SECTION, status, expect, actual);
78 }
79
80
81 function test()
82 {
83 for ( tc=0; tc < testcases.length; tc++ )
84 {
85 testcases[tc].passed = writeTestCaseResult(
86 testcases[tc].expect,
87 testcases[tc].actual,
88 testcases[tc].description + " = " + testcases[tc].actual );
89
90 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
91 }
92 stopTest();
93 return (testcases);
94 }