Skip to content

Commit cd238e2

Browse files
mrahul17jasnell
authored andcommitted
test: check inspect array with empty string key
PR-URL: #15258 Refs: #15159 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 354f320 commit cd238e2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/parallel/test-util-inspect.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,12 @@ if (typeof Symbol !== 'undefined') {
959959
assert.strictEqual(util.inspect(x), '{}');
960960
}
961961

962+
{
963+
const x = [];
964+
x[''] = 1;
965+
assert.strictEqual(util.inspect(x), '[ \'\': 1 ]');
966+
}
967+
962968
// The following maxArrayLength tests were introduced after v6.0.0 was released.
963969
// Do not backport to v5/v4 unless all of
964970
// https://github.com/nodejs/node/pull/6334 is backported.

0 commit comments

Comments
 (0)