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 <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • 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.