From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/non262/Number/toString-radix-handling.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/src/tests/non262/Number/toString-radix-handling.js (limited to 'js/src/tests/non262/Number/toString-radix-handling.js') 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!"); -- cgit v1.2.3