|
1 // |reftest| skip-if(Android) -- bug 686143, skip temporarily to see what happens to the frequency and location of Android timeouts |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 |
|
8 /** |
|
9 File Name: 15.9.5.9.js |
|
10 ECMA Section: 15.9.5.9 |
|
11 Description: Date.prototype.getUTCMonth |
|
12 |
|
13 1. Let t be this time value. |
|
14 2. If t is NaN, return NaN. |
|
15 3. Return MonthFromTime(t). |
|
16 |
|
17 Author: christine@netscape.com |
|
18 Date: 12 november 1997 |
|
19 */ |
|
20 |
|
21 var SECTION = "15.9.5.9"; |
|
22 var VERSION = "ECMA_1"; |
|
23 startTest(); |
|
24 var TITLE = "Date.prototype.getUTCMonth()"; |
|
25 |
|
26 writeHeaderToLog( SECTION + " "+ TITLE); |
|
27 |
|
28 addTestCase( TIME_NOW ); |
|
29 addTestCase( TIME_0000 ); |
|
30 addTestCase( TIME_1970 ); |
|
31 addTestCase( TIME_1900 ); |
|
32 addTestCase( TIME_2000 ); |
|
33 addTestCase( UTC_FEB_29_2000 ); |
|
34 addTestCase( UTC_JAN_1_2005 ); |
|
35 |
|
36 new TestCase( SECTION, |
|
37 "(new Date(NaN)).getUTCMonth()", |
|
38 NaN, |
|
39 (new Date(NaN)).getUTCMonth() ); |
|
40 |
|
41 new TestCase( SECTION, |
|
42 "Date.prototype.getUTCMonth.length", |
|
43 0, |
|
44 Date.prototype.getUTCMonth.length ); |
|
45 test(); |
|
46 |
|
47 function addTestCase( t ) { |
|
48 var leap = InLeapYear(t); |
|
49 |
|
50 for ( var m = 0; m < 12; m++ ) { |
|
51 |
|
52 t += TimeInMonth(m, leap); |
|
53 |
|
54 new TestCase( SECTION, |
|
55 "(new Date("+t+")).getUTCMonth()", |
|
56 MonthFromTime(t), |
|
57 (new Date(t)).getUTCMonth() ); |
|
58 |
|
59 new TestCase( SECTION, |
|
60 "(new Date("+(t+1)+")).getUTCMonth()", |
|
61 MonthFromTime(t+1), |
|
62 (new Date(t+1)).getUTCMonth() ); |
|
63 |
|
64 new TestCase( SECTION, |
|
65 "(new Date("+(t-1)+")).getUTCMonth()", |
|
66 MonthFromTime(t-1), |
|
67 (new Date(t-1)).getUTCMonth() ); |
|
68 |
|
69 new TestCase( SECTION, |
|
70 "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()", |
|
71 MonthFromTime(t-TZ_ADJUST), |
|
72 (new Date(t-TZ_ADJUST)).getUTCMonth() ); |
|
73 |
|
74 new TestCase( SECTION, |
|
75 "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()", |
|
76 MonthFromTime(t+TZ_ADJUST), |
|
77 (new Date(t+TZ_ADJUST)).getUTCMonth() ); |
|
78 |
|
79 } |
|
80 } |