From 21a3ae35740e8a89395d05c68dd40814264d4bb0 Mon Sep 17 00:00:00 2001 From: Rahul Mishra Date: Fri, 8 Sep 2017 11:08:37 +0530 Subject: [PATCH] test: check inspect array with empty string key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/15258 Refs: https://github.com/nodejs/node/issues/15159 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- test/parallel/test-util-inspect.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 6bfce5abcb..f4e7bb9e5b 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -968,6 +968,12 @@ if (typeof Symbol !== 'undefined') { assert.strictEqual(util.inspect(x), '{}'); } +{ + const x = []; + x[''] = 1; + assert.strictEqual(util.inspect(x), '[ \'\': 1 ]'); +} + // The following maxArrayLength tests were introduced after v6.0.0 was released. // Do not backport to v5/v4 unless all of // https://github.com/nodejs/node/pull/6334 is backported.