diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-12 17:14:41 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-19 16:31:11 +0100 |
commit | 0f58ae392b0f90a64dde5ca48c3937bf5d586214 (patch) | |
tree | 2a8a3f1eae7eccdbef85b567eb4a1421cf94891d /test/parallel/test-util-format.js | |
parent | 728b155870b69a83b806d8bee67aeb0fd0a9b2dd (diff) | |
download | android-node-v8-0f58ae392b0f90a64dde5ca48c3937bf5d586214.tar.gz android-node-v8-0f58ae392b0f90a64dde5ca48c3937bf5d586214.tar.bz2 android-node-v8-0f58ae392b0f90a64dde5ca48c3937bf5d586214.zip |
util: `format()` now formats bigint and booleans
This is necessary to distinguish them from other data types.
PR-URL: https://github.com/nodejs/node/pull/25046
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Diffstat (limited to 'test/parallel/test-util-format.js')
-rw-r--r-- | test/parallel/test-util-format.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index 066b4de58c..a90e52946b 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -316,10 +316,27 @@ assert.strictEqual(util.format(new BadCustomError('foo')), assert.strictEqual(util.format('1', '1'), '1 1'); assert.strictEqual(util.format(1, '1'), '1 1'); assert.strictEqual(util.format('1', 1), '1 1'); -assert.strictEqual(util.format(1, 1), '1 1'); +assert.strictEqual(util.format(1, -0), '1 -0'); assert.strictEqual(util.format('1', () => {}), '1 [Function]'); assert.strictEqual(util.format(1, () => {}), '1 [Function]'); assert.strictEqual(util.format('1', "'"), "1 '"); assert.strictEqual(util.format(1, "'"), "1 '"); assert.strictEqual(util.format('1', 'number'), '1 number'); assert.strictEqual(util.format(1, 'number'), '1 number'); +assert.strictEqual(util.format(5n), '5n'); +assert.strictEqual(util.format(5n, 5n), '5n 5n'); + +// Check `formatWithOptions`. +assert.strictEqual( + util.formatWithOptions( + { colors: true }, + true, undefined, Symbol(), 1, 5n, null, 'foobar' + ), + '\u001b[33mtrue\u001b[39m ' + + '\u001b[90mundefined\u001b[39m ' + + '\u001b[32mSymbol()\u001b[39m ' + + '\u001b[33m1\u001b[39m ' + + '\u001b[33m5n\u001b[39m ' + + '\u001b[1mnull\u001b[22m ' + + 'foobar' +); |