Skip to content

Commit

Permalink
test: add coverage for sparse array maxArrayLength
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
wentout authored and targos committed Jun 1, 2019
1 parent cc69d5a commit 6129376
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
util.inspect(a, { maxArrayLength: 4 }),
"[ 'foo', <1 empty item>, 'baz', <97 empty items>, ... 1 more item ]"
);
// test 4 special case
assert.strictEqual(util.inspect(a, {
maxArrayLength: 2
}), "[ 'foo', <1 empty item>, ... 99 more items ]");
}

// Test for Array constructor in different context.
Expand Down

0 comments on commit 6129376

Please sign in to comment.