blob: 325914345cf44835cf9aecd354bc4ccd5541045b [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001var inspect = require('../');
2var test = require('tape');
3
4test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
5 t.test('primitives', function (st) {
6 st.plan(3);
7
8 st.equal(inspect(BigInt(-256)), '-256n');
9 st.equal(inspect(BigInt(0)), '0n');
10 st.equal(inspect(BigInt(256)), '256n');
11 });
12
13 t.test('objects', function (st) {
14 st.plan(3);
15
16 st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)');
17 st.equal(inspect(Object(BigInt(0))), 'Object(0n)');
18 st.equal(inspect(Object(BigInt(256))), 'Object(256n)');
19 });
20
21 t.test('syntactic primitives', function (st) {
22 st.plan(3);
23
24 /* eslint-disable no-new-func */
25 st.equal(inspect(Function('return -256n')()), '-256n');
26 st.equal(inspect(Function('return 0n')()), '0n');
27 st.equal(inspect(Function('return 256n')()), '256n');
28 });
29
30 t.end();
31});