Skip to content

Commit b613950

Browse files
Trottdanielleadams
authored andcommitted
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: #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>
1 parent 2344e3e commit b613950

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/parallel/test-util-inspect.js

+20
Original file line numberDiff line numberDiff line change
@@ -2991,3 +2991,23 @@ assert.strictEqual(
29912991
// Consistency check.
29922992
assert(fullObjectGraph(global).has(Function.prototype));
29932993
}
2994+
2995+
{
2996+
// Confirm that own constructor value displays correctly.
2997+
2998+
function Fhqwhgads() {}
2999+
3000+
const sterrance = new Fhqwhgads();
3001+
sterrance.constructor = Fhqwhgads;
3002+
3003+
assert.strictEqual(
3004+
util.inspect(sterrance, { showHidden: true }),
3005+
'Fhqwhgads {\n' +
3006+
' constructor: <ref *1> [Function: Fhqwhgads] {\n' +
3007+
' [length]: 0,\n' +
3008+
" [name]: 'Fhqwhgads',\n" +
3009+
' [prototype]: { [constructor]: [Circular *1] }\n' +
3010+
' }\n' +
3011+
'}'
3012+
);
3013+
}

0 commit comments

Comments
 (0)