mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: increase coverage for util.inspect()
Confirm that own constructor value displays correctly. Refs: https://coverage.nodejs.org/coverage-0d468ab200584c3a/lib/internal/util/inspect.js.html#L550 PR-URL: https://github.com/nodejs/node/pull/36228 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -2991,3 +2991,23 @@ assert.strictEqual(
|
||||
// Consistency check.
|
||||
assert(fullObjectGraph(global).has(Function.prototype));
|
||||
}
|
||||
|
||||
{
|
||||
// Confirm that own constructor value displays correctly.
|
||||
|
||||
function Fhqwhgads() {}
|
||||
|
||||
const sterrance = new Fhqwhgads();
|
||||
sterrance.constructor = Fhqwhgads;
|
||||
|
||||
assert.strictEqual(
|
||||
util.inspect(sterrance, { showHidden: true }),
|
||||
'Fhqwhgads {\n' +
|
||||
' constructor: <ref *1> [Function: Fhqwhgads] {\n' +
|
||||
' [length]: 0,\n' +
|
||||
" [name]: 'Fhqwhgads',\n" +
|
||||
' [prototype]: { [constructor]: [Circular *1] }\n' +
|
||||
' }\n' +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user