summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/Date/toISOString.js
blob: 9eb41293450b4c1b1754de7bde8df668bf38235c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/
 */

function throwsRangeError(t) {
    try {
        var date = new Date();
        date.setTime(t);
        var r = date.toISOString();
        throw new Error("toISOString didn't throw, instead returned " + r);
    } catch (err) {
        assertEq(err instanceof RangeError, true, 'wrong error: ' + err);
        return;
    }
    assertEq(0, 1, 'not good, nyan, nyan');
}

throwsRangeError(Infinity);
throwsRangeError(-Infinity);
throwsRangeError(NaN);

if (typeof reportCompare === "function")
  reportCompare(true, true);