test: add coverage for util.inspect()

Coverage stats indicate that there is no coverage for util.inspect()
with a negative number and a numeric separator. Add a test case.

Refs: https://coverage.nodejs.org/coverage-df507758e6c35534/lib/internal/util/inspect.js.html#L1463

PR-URL: https://github.com/nodejs/node/pull/41527
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
Rich Trott
2022-01-14 16:25:00 +00:00
parent 20347d5154
commit 0594577e69

View File

@@ -3231,4 +3231,9 @@ assert.strictEqual(
util.inspect(123456789.12345678, { numericSeparator: true }),
'123_456_789.123_456_78'
);
assert.strictEqual(
util.inspect(-123456789.12345678, { numericSeparator: true }),
'-123_456_789.123_456_78'
);
}