js/src/tests/test262/intl402/ch13/13.3/13.3.0_2.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 // Copyright 2012 Mozilla Corporation. All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * @description Tests that Date.prototype.toLocaleString & Co. handle non-finite values correctly.
     6  * @author Norbert Lindenberg
     7  */
     9 var functions = {
    10     toLocaleString: Date.prototype.toLocaleString,
    11     toLocaleDateString: Date.prototype.toLocaleDateString,
    12     toLocaleTimeString: Date.prototype.toLocaleTimeString
    13 };
    14 var invalidValues = [NaN, Infinity, -Infinity];
    16 Object.getOwnPropertyNames(functions).forEach(function (p) {
    17     var f = functions[p];
    18     invalidValues.forEach(function (value) {
    19         var result = f.call(new Date(value));
    20         if (result !== "Invalid Date") {
    21             $ERROR("Date.prototype." + p + " did not return \"Invalid Date\" for " +
    22                 value + " – got " + result + " instead.");
    23         }
    24     });
    25 });

mercurial