Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de34cfa

Browse filesBrowse files
addaleaxtargos
authored andcommitted
test: make sure linked lists are inspectable with defaults
Make sure that a long singly-linked list can be passed to `util.inspect()` without causing a stack overflow. PR-URL: #20017 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent de06115 commit de34cfa
Copy full SHA for de34cfa

File tree

Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
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
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,3 +1404,15 @@ util.inspect(process);
14041404
const args = (function() { return arguments; })('a');
14051405
assert.strictEqual(util.inspect(args), "[Arguments] { '0': 'a' }");
14061406
}
1407+
1408+
{
1409+
// Test that a long linked list can be inspected without throwing an error.
1410+
const list = {};
1411+
let head = list;
1412+
// The real cutoff value is closer to 1400 stack frames as of May 2018,
1413+
// but let's be generous here – even a linked listed of length 100k should be
1414+
// inspectable in some way.
1415+
for (let i = 0; i < 100000; i++)
1416+
head = head.next = {};
1417+
util.inspect(list);
1418+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.