From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../asUintN/bigint-tobigint-wrapped-values.js | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js (limited to 'js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js') diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js new file mode 100644 index 0000000000..f1afb4d0e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: BigInt.asUintN type coercion for bigint parameter +esid: pending +info: | + BigInt.asUintN ( bits, bigint ) + + 2. Let bigint ? ToBigInt(bigint). +features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive] +---*/ + +assert.sameValue(BigInt.asUintN(2, Object(0n)), 0n, "ToPrimitive: unbox object with internal slot"); +assert.sameValue(BigInt.asUintN(2, { + [Symbol.toPrimitive]: function() { + return 0n; + } +}), 0n, "ToPrimitive: @@toPrimitive"); +assert.sameValue(BigInt.asUintN(2, { + valueOf: function() { + return 0n; + } +}), 0n, "ToPrimitive: valueOf"); +assert.sameValue(BigInt.asUintN(2, { + toString: function() { + return 0n; + } +}), 0n, "ToPrimitive: toString"); +assert.sameValue(BigInt.asUintN(2, Object(true)), 1n, + "ToBigInt: unbox object with internal slot => true => 1n"); +assert.sameValue(BigInt.asUintN(2, { + [Symbol.toPrimitive]: function() { + return true; + } +}), 1n, "ToBigInt: @@toPrimitive => true => 1n"); +assert.sameValue(BigInt.asUintN(2, { + valueOf: function() { + return true; + } +}), 1n, "ToBigInt: valueOf => true => 1n"); +assert.sameValue(BigInt.asUintN(2, { + toString: function() { + return true; + } +}), 1n, "ToBigInt: toString => true => 1n"); +assert.sameValue(BigInt.asUintN(2, Object("1")), 1n, + "ToBigInt: unbox object with internal slot => parse BigInt"); +assert.sameValue(BigInt.asUintN(2, { + [Symbol.toPrimitive]: function() { + return "1"; + } +}), 1n, "ToBigInt: @@toPrimitive => parse BigInt"); +assert.sameValue(BigInt.asUintN(2, { + valueOf: function() { + return "1"; + } +}), 1n, "ToBigInt: valueOf => parse BigInt"); +assert.sameValue(BigInt.asUintN(2, { + toString: function() { + return "1"; + } +}), 1n, "ToBigInt: toString => parse BigInt"); + +reportCompare(0, 0); -- cgit v1.2.3