From e182ca9bdcc47c0a8b0045bf0f574fe4613291d2 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 23 Dec 2018 17:42:27 +0100 Subject: [PATCH] test: add more inspect subclassing tests So far we do not test all data types for subclasses and this extends the existing tests for WeakSet, WeakMap and BigInt64Array. PR-URL: https://github.com/nodejs/node/pull/25192 Reviewed-By: Anto Aravinth Reviewed-By: James M Snell --- test/parallel/test-util-inspect.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 9ee02720897505..66887a10f48cd3 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1662,7 +1662,10 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); // Verify that subclasses with and without prototype produce nice results. [ - [RegExp, ['foobar', 'g'], '/foobar/g'] + [RegExp, ['foobar', 'g'], '/foobar/g'], + [WeakSet, [[{}]], '{ }'], + [WeakMap, [[[{}, {}]]], '{ }'], + [BigInt64Array, [10], '[ 0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n, 0n ]'] ].forEach(([base, input, rawExpected]) => { class Foo extends base {} const value = new Foo(...input);