Skip to content

Commit 0ea06ff

Browse files
committed
test: check util.inspect for array having empty string as key
Refs: nodejs#15159
1 parent 11b7428 commit 0ea06ff

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
@@ -968,6 +968,12 @@ if (typeof Symbol !== 'undefined') {
968968
assert.strictEqual(util.inspect(x), '{}');
969969
}
970970

971+
{
972+
const x = [];
973+
x[''] = 1;
974+
assert.strictEqual(util.inspect(x), '[ \'\': 1 ]');
975+
}
976+
971977
// The following maxArrayLength tests were introduced after v6.0.0 was released.
972978
// Do not backport to v5/v4 unless all of
973979
// https://github.com/nodejs/node/pull/6334 is backported.

0 commit comments

Comments
 (0)