From f947f72b398088dc0d92abd63271f9a13218235d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 19 Jan 2022 12:16:41 -0800 Subject: [PATCH] test: improve util-format code coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test case for calling `util.format()` with a BigInt and a separator. Refs: https://coverage.nodejs.org/coverage-986cf3b986c6c3e1/lib/internal/util/inspect.js.html#L2042 PR-URL: https://github.com/nodejs/node/pull/41572 Reviewed-By: Tobias Nießen Reviewed-By: Mestery Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Zeyu Yang --- test/parallel/test-util-format.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index 36c98bcb9790b5..ab0d50f743fd98 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -143,6 +143,13 @@ assert.strictEqual( '1180591620717411303424n 12345678901234567890123n' ); +assert.strictEqual( + util.formatWithOptions( + { numericSeparator: true }, + '%i %d', 1180591620717411303424n, 12345678901234567890123n), + '1_180_591_620_717_411_303_424n 12_345_678_901_234_567_890_123n' +); + // Float format specifier assert.strictEqual(util.format('%f'), '%f'); assert.strictEqual(util.format('%f', 42.0), '42');