GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: add test case for `util.inspect` · nodejs/node@23275cc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-util-inspect.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js
+30Lines 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+
const o = { ['__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+
const sym = Symbol('bar');
3336+
const o = {
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 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.