Debian Codegraph @

js/src/tests/test262/built-ins/BigInt/constructor-from-octal-string.js

raw
1 // Copyright (C) 2017 Caio Lima. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: Octal prefixed String should be parsed to BigInt according StringToBigInt
6 esid: sec-string-to-bigint
7 info: |
8 ToBigInt ( argument )
9
10 String:
11
12 Let n be StringToBigInt(prim).
13 If n is NaN, throw a SyntaxError exception.
14 Return n.
15
16 StringToBigInt ( argument )
17
18 Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity, decimal points, or exponents.
19
20 features: [BigInt]
21 ---*/
22
23 assert.sameValue(BigInt("0o7"), 7n);
24 assert.sameValue(BigInt("0o10"), 8n);
25 assert.sameValue(BigInt("0o20"), 16n);
26
27 assert.sameValue(BigInt("0O7"), 7n);
28 assert.sameValue(BigInt("0O10"), 8n);
29 assert.sameValue(BigInt("0O20"), 16n);
30
31 reportCompare(0, 0);