1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
big_int_positive: {
input: {
1000n
}
expect_exact: "1000n;"
}
big_int_negative: {
input: {
-15n
}
expect_exact: "-15n;"
}
big_int_hex: {
input: {
0x20n
0xfabn
}
expect_exact: "0x20n;0xfabn;"
no_mozilla_ast: true
}
regression_big_int_hex_lower_with_e: {
input: {
0xaefen;
}
expect_exact: "0xaefen;"
no_mozilla_ast: true
}
big_int_binary: {
input: {
0b101n
}
expect_exact: "0b101n;"
no_mozilla_ast: true
}
big_int_octal: {
input: {
0o7n
}
expect_exact: "0o7n;"
no_mozilla_ast: true
}
big_int_no_e: {
bad_input: `1e3n`
expect_error: ({
name: "SyntaxError",
message: "Invalid or unexpected token"
})
}
big_int_bad_digits_for_base: {
bad_input: `0o9n`
expect_error: ({
name: "SyntaxError",
message: "Invalid or unexpected token"
})
}
big_int_math: {
options = {
defaults: true
}
input: {
console.log({
sum: 10n + 15n,
exp: 2n ** 3n,
sub: 1n - 3n,
mul: 5n * 5n,
div: 15n / 5n,
});
}
expect_exact: "console.log({sum:25n,exp:8n,sub:-2n,mul:25n,div:3n});"
expect_stdout: true
}
big_int_math_counter_examples: {
node_version = ">= 12"
options = {
defaults: true
}
input: {
console.log({
mixing_types: 1 * 10n,
bad_shift: 1n >>> 0n,
bad_div: 1n / 0n,
});
}
expect_exact: "console.log({mixing_types:1*10n,bad_shift:1n>>>0n,bad_div:1n/0n});"
expect_stdout: true
}
|