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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
went.out authored and Ujjwal Sharma committed 2019-06-01 14:35:11 +05:30
1 parent 4ec6135c71
commit dcd0ba1814
1 file changed
+4
+4
View File
@@ -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.