From dcd0ba1814ab94c0f2fd99f23bed88ce4b1bb821 Mon Sep 17 00:00:00 2001 From: "went.out" Date: Thu, 30 May 2019 03:31:42 +0300 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig Reviewed-By: Ujjwal Sharma Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson Reviewed-By: Ruben Bridgewater --- test/parallel/test-util-inspect.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index d53b151ca15..834b0c0236a 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -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.