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 <[email protected]>
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
  • Loading branch information
Trott authored and BethGriggs committed Jan 24, 2022
1 parent b43faf0 commit f947f72
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 f947f72

Please sign in to comment.