0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-util-inspect-bigint.js
Michaël Zasso 893432ad92
util: add boxed BigInt formatting to util.inspect
Before:

> Object(7n)
BigInt {}

After:

> Object(7n)
[BigInt: 7n]

PR-URL: https://github.com/nodejs/node/pull/19341
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2018-03-17 11:37:53 +01:00

13 lines
295 B
JavaScript

'use strict';
// Flags: --harmony-bigint
require('../common');
const assert = require('assert');
const { inspect } = require('util');
assert.strictEqual(inspect(1n), '1n');
assert.strictEqual(inspect(Object(-1n)), '[BigInt: -1n]');
assert.strictEqual(inspect(Object(13n)), '[BigInt: 13n]');