js/src/tests/ecma/Date/15.9.5.9.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     8 /**
     9    File Name:          15.9.5.9.js
    10    ECMA Section:       15.9.5.9
    11    Description:        Date.prototype.getUTCMonth
    13    1.  Let t be this time value.
    14    2.  If t is NaN, return NaN.
    15    3.  Return MonthFromTime(t).
    17    Author:             christine@netscape.com
    18    Date:               12 november 1997
    19 */
    21 var SECTION = "15.9.5.9";
    22 var VERSION = "ECMA_1";
    23 startTest();
    24 var TITLE   = "Date.prototype.getUTCMonth()";
    26 writeHeaderToLog( SECTION + " "+ TITLE);
    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 );
    36 new TestCase( SECTION,
    37 	      "(new Date(NaN)).getUTCMonth()",
    38 	      NaN,
    39 	      (new Date(NaN)).getUTCMonth() );
    41 new TestCase( SECTION,
    42 	      "Date.prototype.getUTCMonth.length",
    43 	      0,
    44 	      Date.prototype.getUTCMonth.length );
    45 test();
    47 function addTestCase( t ) {
    48   var leap = InLeapYear(t);
    50   for ( var m = 0; m < 12; m++ ) {
    52     t += TimeInMonth(m, leap);
    54     new TestCase( SECTION,
    55 		  "(new Date("+t+")).getUTCMonth()",
    56 		  MonthFromTime(t),
    57 		  (new Date(t)).getUTCMonth() );
    59     new TestCase( SECTION,
    60 		  "(new Date("+(t+1)+")).getUTCMonth()",
    61 		  MonthFromTime(t+1),
    62 		  (new Date(t+1)).getUTCMonth() );
    64     new TestCase( SECTION,
    65 		  "(new Date("+(t-1)+")).getUTCMonth()",
    66 		  MonthFromTime(t-1),
    67 		  (new Date(t-1)).getUTCMonth() );
    69     new TestCase( SECTION,
    70 		  "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
    71 		  MonthFromTime(t-TZ_ADJUST),
    72 		  (new Date(t-TZ_ADJUST)).getUTCMonth() );
    74     new TestCase( SECTION,
    75 		  "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
    76 		  MonthFromTime(t+TZ_ADJUST),
    77 		  (new Date(t+TZ_ADJUST)).getUTCMonth() );
    79   }
    80 }

mercurial