Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/BigInt/constructor-from-string-syntax-errors.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: Invalid String into BigInt constructor should throw SyntaxError
6 esid: sec-string-to-bigint
7 info: |
8 Apply the algorithm in 3.1.3.1 with the following changes:
9
10 - Replace the StrUnsignedDecimalLiteral production with DecimalDigits
11 to not allow decimal points or exponents.
12
13 features: [BigInt]
14 ---*/
15
16 assert.throws(SyntaxError, function() {
17 BigInt("10n");
18 });
19
20 assert.throws(SyntaxError, function() {
21 BigInt("10x");
22 });
23
24 assert.throws(SyntaxError, function() {
25 BigInt("10b");
26 });
27
28 assert.throws(SyntaxError, function() {
29 BigInt("10.5");
30 });
31
32 assert.throws(SyntaxError, function() {
33 BigInt("0b");
34 });
35
36 assert.throws(SyntaxError, function() {
37 BigInt("-0x1");
38 });
39
40 assert.throws(SyntaxError, function() {
41 BigInt("-0XFFab");
42 });
43
44 assert.throws(SyntaxError, function() {
45 BigInt("0oa");
46 });
47
48 assert.throws(SyntaxError, function() {
49 BigInt("000 12");
50 });
51
52 assert.throws(SyntaxError, function() {
53 BigInt("0o");
54 });
55
56 assert.throws(SyntaxError, function() {
57 BigInt("0x");
58 });
59
60 assert.throws(SyntaxError, function() {
61 BigInt("00o");
62 });
63
64 assert.throws(SyntaxError, function() {
65 BigInt("00b");
66 });
67
68 assert.throws(SyntaxError, function() {
69 BigInt("00x");
70 });