Skip to content

Commit 23275cc

Browse files
ljharbnodejs-github-bot
authored andcommitted
test: add test case for util.inspect
PR-URL: #55778 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 9f2885a commit 23275cc

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎test/parallel/test-util-inspect.js‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,6 +3258,13 @@ assert.strictEqual(
32583258
util.inspect({['__proto__']: {a: 1}}),
32593259
"{ ['__proto__']: { a: 1 } }"
32603260
);
3261+
3262+
consto={['__proto__']: {a: 1}};
3263+
Object.defineProperty(o,'__proto__',{enumerable: false});
3264+
assert.strictEqual(
3265+
util.inspect(o,{showHidden: true}),
3266+
"{ ['__proto__']: { a: 1 } }"
3267+
);
32613268
}
32623269

32633270
{
@@ -3323,3 +3330,26 @@ assert.strictEqual(
33233330
}
33243331
}),'{ [Symbol(Symbol.iterator)]: [Getter] }');
33253332
}
3333+
3334+
{
3335+
constsym=Symbol('bar');
3336+
consto={
3337+
'foo': 0,
3338+
'Symbol(foo)': 0,
3339+
[Symbol('foo')]: 0,
3340+
[Symbol('foo()')]: 0,
3341+
[sym]: 0,
3342+
};
3343+
Object.defineProperty(o,sym,{enumerable: false});
3344+
3345+
assert.strictEqual(
3346+
util.inspect(o,{showHidden: true}),
3347+
'{\n'+
3348+
' foo: 0,\n'+
3349+
" 'Symbol(foo)': 0,\n"+
3350+
' [Symbol(foo)]: 0,\n'+
3351+
' [Symbol(foo())]: 0,\n'+
3352+
' [Symbol(bar)]: 0\n'+
3353+
'}',
3354+
);
3355+
}

0 commit comments

Comments
 (0)