Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / BigInt / constructor-from-hex-string.js
blobd6490a9ca51d3c43c9bebb290b12f347dbb1d470
1 // Copyright (C) 2017 Caio Lima. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: Hexdecimal prefixed String should be parsed to BigInt according StringToBigInt
6 esid: sec-string-to-bigint
7 info: |
8   ToBigInt ( argument )
10   String:
12   Let n be StringToBigInt(prim).
13   If n is NaN, throw a SyntaxError exception.
14   Return n.
16   StringToBigInt ( argument )
18   Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
20 features: [BigInt]
21 ---*/
23 assert.sameValue(BigInt("0xa"), 10n);
24 assert.sameValue(BigInt("0xff"), 255n);
25 assert.sameValue(BigInt("0xfabc"), 64188n);
26 assert.sameValue(BigInt("0xfffffffffffffffffff"), 75557863725914323419135n);
28 assert.sameValue(BigInt("0Xa"), 10n);
29 assert.sameValue(BigInt("0Xff"), 255n);
30 assert.sameValue(BigInt("0Xfabc"), 64188n);
31 assert.sameValue(BigInt("0Xfffffffffffffffffff"), 75557863725914323419135n);
33 reportCompare(0, 0);