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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Date/15.9.5.9.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,80 @@
     1.4 +// |reftest| skip-if(Android) -- bug 686143, skip temporarily to see what happens to the frequency and location of Android timeouts
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +
    1.11 +/**
    1.12 +   File Name:          15.9.5.9.js
    1.13 +   ECMA Section:       15.9.5.9
    1.14 +   Description:        Date.prototype.getUTCMonth
    1.15 +
    1.16 +   1.  Let t be this time value.
    1.17 +   2.  If t is NaN, return NaN.
    1.18 +   3.  Return MonthFromTime(t).
    1.19 +
    1.20 +   Author:             christine@netscape.com
    1.21 +   Date:               12 november 1997
    1.22 +*/
    1.23 +
    1.24 +var SECTION = "15.9.5.9";
    1.25 +var VERSION = "ECMA_1";
    1.26 +startTest();
    1.27 +var TITLE   = "Date.prototype.getUTCMonth()";
    1.28 +
    1.29 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.30 +
    1.31 +addTestCase( TIME_NOW );
    1.32 +addTestCase( TIME_0000 );
    1.33 +addTestCase( TIME_1970 );
    1.34 +addTestCase( TIME_1900 );
    1.35 +addTestCase( TIME_2000 );
    1.36 +addTestCase( UTC_FEB_29_2000 );
    1.37 +addTestCase( UTC_JAN_1_2005 );
    1.38 +
    1.39 +new TestCase( SECTION,
    1.40 +	      "(new Date(NaN)).getUTCMonth()",
    1.41 +	      NaN,
    1.42 +	      (new Date(NaN)).getUTCMonth() );
    1.43 +
    1.44 +new TestCase( SECTION,
    1.45 +	      "Date.prototype.getUTCMonth.length",
    1.46 +	      0,
    1.47 +	      Date.prototype.getUTCMonth.length );
    1.48 +test();
    1.49 +
    1.50 +function addTestCase( t ) {
    1.51 +  var leap = InLeapYear(t);
    1.52 +
    1.53 +  for ( var m = 0; m < 12; m++ ) {
    1.54 +
    1.55 +    t += TimeInMonth(m, leap);
    1.56 +
    1.57 +    new TestCase( SECTION,
    1.58 +		  "(new Date("+t+")).getUTCMonth()",
    1.59 +		  MonthFromTime(t),
    1.60 +		  (new Date(t)).getUTCMonth() );
    1.61 +
    1.62 +    new TestCase( SECTION,
    1.63 +		  "(new Date("+(t+1)+")).getUTCMonth()",
    1.64 +		  MonthFromTime(t+1),
    1.65 +		  (new Date(t+1)).getUTCMonth() );
    1.66 +
    1.67 +    new TestCase( SECTION,
    1.68 +		  "(new Date("+(t-1)+")).getUTCMonth()",
    1.69 +		  MonthFromTime(t-1),
    1.70 +		  (new Date(t-1)).getUTCMonth() );
    1.71 +
    1.72 +    new TestCase( SECTION,
    1.73 +		  "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
    1.74 +		  MonthFromTime(t-TZ_ADJUST),
    1.75 +		  (new Date(t-TZ_ADJUST)).getUTCMonth() );
    1.76 +
    1.77 +    new TestCase( SECTION,
    1.78 +		  "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
    1.79 +		  MonthFromTime(t+TZ_ADJUST),
    1.80 +		  (new Date(t+TZ_ADJUST)).getUTCMonth() );
    1.81 +
    1.82 +  }
    1.83 +}

mercurial