From 6d4b9a55f14d9e6c197a1394cf5b304e0ee2b381 Mon Sep 17 00:00:00 2001 From: Robin Templeton Date: Tue, 17 Apr 2018 20:25:35 -0400 Subject: [PATCH] test BigInt toString with default radix Thanks to Jeff Walden for suggesting this test case. --- .../prototype/toString/default-radix.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/built-ins/BigInt/prototype/toString/default-radix.js diff --git a/test/built-ins/BigInt/prototype/toString/default-radix.js b/test/built-ins/BigInt/prototype/toString/default-radix.js new file mode 100644 index 0000000000..edcab3c8ca --- /dev/null +++ b/test/built-ins/BigInt/prototype/toString/default-radix.js @@ -0,0 +1,19 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-bigint.prototype.tostring +description: toString with default radix +features: [BigInt] +---*/ + +assert.sameValue((-100n).toString(), "-100", "(-100n).toString() === '-100'"); +assert.sameValue((0n).toString(), "0", "(0n).toString() === '0'"); +assert.sameValue((100n).toString(), "100", "(100n).toString() === '100'"); + +assert.sameValue((-100n).toString(undefined), "-100", + "(-100n).toString(undefined) === '-100'"); +assert.sameValue((0n).toString(undefined), "0", + "(0n).toString(undefined) === '0'"); +assert.sameValue((100n).toString(undefined), "100", + "(100n).toString(undefined) === '100'");