Skip to content

Commit

Permalink
test: add more inspect subclassing tests
Browse files Browse the repository at this point in the history
So far we do not test all data types for subclasses and this extends
the existing tests for WeakSet, WeakMap and BigInt64Array.

PR-URL: #25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR authored and targos committed Jan 1, 2019
1 parent 73f3a1c commit e182ca9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, [[{}]], '{ <items unknown> }'],
[WeakMap, [[[{}, {}]]], '{ <items unknown> }'],
[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);
Expand Down

0 comments on commit e182ca9

Please sign in to comment.