From 34d1d791e56e0d2053af6a8eb483edeec0e57609 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 24 Dec 2020 16:14:43 -0800 Subject: [PATCH] test: improve coverage for util.inspect() with classes Refs: https://github.com/nodejs/node/pull/36622#pullrequestreview-558721102 PR-URL: https://github.com/nodejs/node/pull/36625 Reviewed-By: Antoine du Hamel Reviewed-By: Benjamin Gruenbaum --- test/parallel/test-util-inspect.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index b14cab3d13358a..ad8da0a7a47e9d 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -2011,6 +2011,11 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); rest[rest.length - 1] = rest[rest.length - 1].slice(0, -1); rest.length = 1; } + Object.setPrototypeOf(clazz, Map.prototype); + assert.strictEqual( + util.inspect(clazz), + ['[class', name, '[Map]', ...rest].join(' ') + ']' + ); Object.setPrototypeOf(clazz, null); assert.strictEqual( util.inspect(clazz),