From 9cebe8296a905478e0a7bfeb5da29901c4cf7b56 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 2f3ef367328f9e..b17b14f65cba99 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -831,6 +831,12 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); 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.