Skip to content

Commit

Permalink
test: improve util-format code coverage
Browse files Browse the repository at this point in the history
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: #41572
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
  • Loading branch information
Trott authored and danielleadams committed Mar 14, 2022
1 parent 1ef28f1 commit 2c813d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/parallel/test-util-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 2c813d8

Please sign in to comment.