Skip to content

Commit 6129376

Browse files
wentouttargos
authored andcommitted
test: add coverage for sparse array maxArrayLength
code and learn task for additional coverage for situation when maxArrayLength option is passed to util.inspect for sparse array and is set to number lower than actual number of entries PR-URL: #27901 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent cc69d5a commit 6129376

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/parallel/test-util-inspect.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
520520
util.inspect(a, { maxArrayLength: 4 }),
521521
"[ 'foo', <1 empty item>, 'baz', <97 empty items>, ... 1 more item ]"
522522
);
523+
// test 4 special case
524+
assert.strictEqual(util.inspect(a, {
525+
maxArrayLength: 2
526+
}), "[ 'foo', <1 empty item>, ... 99 more items ]");
523527
}
524528

525529
// Test for Array constructor in different context.

0 commit comments

Comments
 (0)