Debian Codegraph @

rhino/testsrc/tests/ecma_3/Date/15.9.5.5-02.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 var gTestfile = '15.9.5.5-02.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 398485;
9 var summary = 'Date.prototype.toLocaleString should not clamp year';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var d;
25 var y;
26 var l;
27 var maxms = 8640000000000000;
28
29 d = new Date(-maxms );
30 y = d.getFullYear();
31 l = d.toLocaleString();
32 print(l);
33
34 actual = y;
35 expect = -271821;
36 reportCompare(expect, actual, summary + ': check year');
37
38 actual = l.match(new RegExp(y)) + '';
39 expect = y + '';
40 reportCompare(expect, actual, summary + ': check toLocaleString');
41
42 d = new Date(maxms );
43 y = d.getFullYear();
44 l = d.toLocaleString();
45 print(l);
46
47 actual = y;
48 expect = 275760;
49 reportCompare(expect, actual, summary + ': check year');
50
51 actual = l.match(new RegExp(y)) + '';
52 expect = y + '';
53 reportCompare(expect, actual, summary + ': check toLocaleString');
54
55 exitFunc ('test');
56 }