summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Number/20.1.3.3-toFixed.js
blob: 28b57ddaa2f5ced2372cbdc1985157bcba457264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * Any copyright is dedicated to the Public Domain.
 * https://creativecommons.org/publicdomain/zero/1.0/
 */

assertEq(Number.prototype.toFixed.call(-Infinity), "-Infinity");
assertEq(Number.prototype.toFixed.call(Infinity), "Infinity");
assertEq(Number.prototype.toFixed.call(NaN), "NaN");

assertThrowsInstanceOf(() => Number.prototype.toFixed.call(-Infinity, 555), RangeError);
assertThrowsInstanceOf(() => Number.prototype.toFixed.call(Infinity, 555), RangeError);
assertThrowsInstanceOf(() => Number.prototype.toFixed.call(NaN, 555), RangeError);

assertThrowsInstanceOf(() => Number.prototype.toFixed.call("Hello"), TypeError);

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