diff --git a/test/built-ins/BigInt/call-value-of-when-to-string-present.js b/test/built-ins/BigInt/call-value-of-when-to-string-present.js new file mode 100644 index 0000000000000000000000000000000000000000..95b89af322d0212c84bba98261918af384deeef6 --- /dev/null +++ b/test/built-ins/BigInt/call-value-of-when-to-string-present.js @@ -0,0 +1,25 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ToPrimitive receives "hint Number" as parameter, then valueOf needs to be called +esid: sec-bigint-constructor-number-value +info: | + 1. If NewTarget is not undefined, throw a TypeError exception. + 2. Let prim be ? ToPrimitive(value, hint Number). + ... +features: [BigInt] +---*/ + +let o = { + valueOf: function() { + return 44; + }, + + toString: function() { + throw new Test262Error("unreachable"); + } +} + +assert.sameValue(BigInt(o), 44n); + diff --git a/test/built-ins/BigInt/value-of-throws.js b/test/built-ins/BigInt/value-of-throws.js index 36052bc1aae4d5bf561135e68ad2e4c7dca710d1..af479209922abfcaaff0538443a5a4b658ad4b03 100644 --- a/test/built-ins/BigInt/value-of-throws.js +++ b/test/built-ins/BigInt/value-of-throws.js @@ -14,13 +14,13 @@ features: [BigInt] assert.throws(Test262Error, function() { BigInt({ - valueOf: function() { throw new Test262Error("unreachable"); } + valueOf: function() { throw new Test262Error(); } }); } assert.throws(Test262Error, function() { BigInt({ - toString: function() { throw new Test262Error("unreachable"); } + toString: function() { throw new Test262Error(); } }); }