Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommonn.org/licenses/publicdomain/
4 */
6 var BUGNUMBER = 795745;
7 var summary =
8 "Number.prototype.to* should throw a RangeError when passed a bad precision";
10 print(BUGNUMBER + ": " + summary);
12 /**************
13 * BEGIN TEST *
14 **************/
16 function test(method, prec)
17 {
18 try
19 {
20 Number.prototype[method].call(0, prec);
21 throw "should have thrown";
22 }
23 catch (e)
24 {
25 assertEq(e instanceof RangeError, true,
26 "expected RangeError for " + method + " with precision " + prec +
27 ", got " + e);
28 }
29 }
31 test("toExponential", -32);
32 test("toFixed", -32);
33 test("toPrecision", -32);
35 test("toExponential", 9999999);
36 test("toFixed", 9999999);
37 test("toPrecision", 9999999);
39 test("toPrecision", 0);
41 /******************************************************************************/
43 if (typeof reportCompare === "function")
44 reportCompare(true, true);
46 print("Tests complete");