[JSC] Do not use asArrayModes() with Structures because it discards TypedArray inform...
[WebKit-https.git] / JSTests / stress / big-int-white-space-trailing-leading.js
1 //@ runBigIntEnabled
2
3 function assert(a) {
4     if (!a)
5         throw new Error("Bad assertion");
6 }
7
8 function assertThrowSyntaxError(input) {
9     try {
10         eval(input);
11         assert(false);
12     } catch (e) {
13         assert(e instanceof SyntaxError);
14     }
15 }
16
17 var d;
18
19 assert(eval("d=\u000C5n") === 5n);
20 assert(d === 5n);
21
22 assert(eval("d=\u000915n") === 15n);
23 assert(d === 15n);
24
25 assert(eval("d=\u000B19n\u000B;") === 19n);
26 assert(d === 19n);
27
28 assert(eval("d=\u000C119n;") === 119n);
29 assert(d === 119n);
30
31 assert(eval("d=\u002095n;") === 95n);
32 assert(d === 95n);
33
34 assert(eval("d=\u00A053n;") === 53n);
35 assert(d === 53n);
36
37 assert(eval("d=\uFEFF39n;") === 39n);
38 assert(d === 39n);
39
40 assert(eval("d=5n\u000C") === 5n);
41 assert(d === 5n);
42
43 assert(eval("d=15n\u0009") === 15n);
44 assert(d === 15n);
45
46 assert(eval("d=19n\u000B;") === 19n);
47 assert(d === 19n);
48
49 assert(eval("d=119n\u000C;") === 119n);
50 assert(d === 119n);
51
52 assert(eval("d=95n\u0020;") === 95n);
53 assert(d === 95n);
54
55 assert(eval("d=53n\u00A0;") === 53n);
56 assert(d === 53n);
57
58 assert(eval("d=39n\uFEFF;") === 39n);
59 assert(d === 39n);
60
61 assert(eval("\u000C\u000Cd\u000C\u000C=\u000C\u000C5n\u000C;\u000C") === 5n);
62 assert(d === 5n);
63
64 assert(eval("\u0009\u0009d\u0009\u0009=\u0009\u000915n\u0009;") === 15n);
65 assert(d === 15n);
66
67 assert(eval("\u000B\u000Bd\u000B\u000B=\u000B\u000B19n\u000B;") === 19n);
68 assert(d === 19n);
69
70 assert(eval("\u000C\u000Cd\u000C=\u000C\u000C119n;") === 119n);
71 assert(d === 119n);
72
73 assert(eval("\u0020d\u0020=\u0020\u002095n;") === 95n);
74 assert(d === 95n);
75
76 assert(eval("\u00A0d\u00A0=\u00A0\u00A053n;") === 53n);
77 assert(d === 53n);
78
79 assert(eval("\uFEFFd\uFEFF=\uFEFF\uFEFF39n;") === 39n);
80 assert(d === 39n);
81
82 // Assert errors
83
84 assertThrowSyntaxError("0b\u000C2n");
85 assertThrowSyntaxError("0b\u000B1101n");
86 assertThrowSyntaxError("0b\u0009111111n");
87 assertThrowSyntaxError("0b\u002010101n");
88 assertThrowSyntaxError("0b\u00A01011n");
89 assertThrowSyntaxError("0b\uFEFF111000n");
90
91 assertThrowSyntaxError("0o\u000C2n");
92 assertThrowSyntaxError("0o\u000B45n");
93 assertThrowSyntaxError("0o\u000977n");
94 assertThrowSyntaxError("0o\u0020777n");
95 assertThrowSyntaxError("0o\u00A01777n");
96 assertThrowSyntaxError("0o\uFEFF17361n");
97
98 assertThrowSyntaxError("0x\u000C2n");
99 assertThrowSyntaxError("0x\u000B45n");
100 assertThrowSyntaxError("0x\u000977n");
101 assertThrowSyntaxError("0x\u0020777n");
102 assertThrowSyntaxError("0x\u00A01777n");
103 assertThrowSyntaxError("0x\uFEFF17361n");
104
105 assertThrowSyntaxError("2\u000Cn");
106 assertThrowSyntaxError("45\u000Bn");
107 assertThrowSyntaxError("77\u0009n");
108 assertThrowSyntaxError("777\u0020n");
109 assertThrowSyntaxError("1777\u00A0n");
110 assertThrowSyntaxError("17361\uFEFFn");
111