summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Number/toString-radix-handling.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/non262/Number/toString-radix-handling.js')
-rw-r--r--js/src/tests/non262/Number/toString-radix-handling.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/non262/Number/toString-radix-handling.js b/js/src/tests/non262/Number/toString-radix-handling.js
new file mode 100644
index 0000000000..dd91675a27
--- /dev/null
+++ b/js/src/tests/non262/Number/toString-radix-handling.js
@@ -0,0 +1,37 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommonn.org/licenses/publicdomain/
+ */
+
+var BUGNUMBER = 647385;
+var summary =
+ "Number.prototype.toString should use ToInteger on the radix and should " +
+ "throw a RangeError if the radix is bad";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function test(r)
+{
+ try
+ {
+ 5..toString(r);
+ throw "should have thrown";
+ }
+ catch (e)
+ {
+ assertEq(e instanceof RangeError, true, "expected a RangeError, got " + e);
+ }
+}
+test(Math.pow(2, 32) + 10);
+test(55);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("All tests passed!");