js/src/tests/ecma/Date/15.9.5.5.js

Thu, 15 Jan 2015 21:13:52 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:13:52 +0100
branch
TOR_BUG_9701
changeset 12
7540298fafa1
permissions
-rw-r--r--

Remove forgotten relic of ABI crash risk averse overloaded method change.

     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/. */
     7 /**
     8    File Name:          15.9.5.5.js
     9    ECMA Section:       15.9.5.5
    10    Description:        Date.prototype.getYear
    12    This function is specified here for backwards compatibility only. The
    13    function getFullYear is much to be preferred for nearly all purposes,
    14    because it avoids the "year 2000 problem."
    16    1.  Let t be this time value.
    17    2.  If t is NaN, return NaN.
    18    3.  Return YearFromTime(LocalTime(t)) 1900.
    20    Author:             christine@netscape.com
    21    Date:               12 november 1997
    22 */
    24 var SECTION = "15.9.5.5";
    25 var VERSION = "ECMA_1";
    26 startTest();
    27 var TITLE   = "Date.prototype.getYear()";
    29 writeHeaderToLog( SECTION + " "+ TITLE);
    31 addTestCase( TIME_NOW );
    32 addTestCase( TIME_0000 );
    33 addTestCase( TIME_1970 );
    34 addTestCase( TIME_1900 );
    35 addTestCase( TIME_2000 );
    36 addTestCase( UTC_FEB_29_2000 );
    38 new TestCase( SECTION,
    39 	      "(new Date(NaN)).getYear()",
    40 	      NaN,
    41 	      (new Date(NaN)).getYear() );
    43 new TestCase( SECTION,
    44 	      "Date.prototype.getYear.length",
    45 	      0,
    46 	      Date.prototype.getYear.length );
    48 test();
    50 function addTestCase( t ) {
    51   new TestCase( SECTION,
    52 		"(new Date("+t+")).getYear()",
    53 		GetYear(YearFromTime(LocalTime(t))),
    54 		(new Date(t)).getYear() );
    56   new TestCase( SECTION,
    57 		"(new Date("+(t+1)+")).getYear()",
    58 		GetYear(YearFromTime(LocalTime(t+1))),
    59 		(new Date(t+1)).getYear() );
    61   new TestCase( SECTION,
    62 		"(new Date("+(t-1)+")).getYear()",
    63 		GetYear(YearFromTime(LocalTime(t-1))),
    64 		(new Date(t-1)).getYear() );
    66   new TestCase( SECTION,
    67 		"(new Date("+(t-TZ_ADJUST)+")).getYear()",
    68 		GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
    69 		(new Date(t-TZ_ADJUST)).getYear() );
    71   new TestCase( SECTION,
    72 		"(new Date("+(t+TZ_ADJUST)+")).getYear()",
    73 		GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
    74 		(new Date(t+TZ_ADJUST)).getYear() );
    75 }
    76 function GetYear( year ) {
    77   return year - 1900;
    78 }

mercurial