diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-05-06 18:14:59 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-05-11 17:46:56 +0200 |
commit | 5096e249e7b282e9890981e40ed9114ef549d99b (patch) | |
tree | 4230cd602a77aeb7a8a38ed43fa18dbd5088359f /test/parallel/test-util-inspect.js | |
parent | 849aaaeeb045965f3f8085c7cb65c3c830bd724c (diff) | |
download | android-node-v8-5096e249e7b282e9890981e40ed9114ef549d99b.tar.gz android-node-v8-5096e249e7b282e9890981e40ed9114ef549d99b.tar.bz2 android-node-v8-5096e249e7b282e9890981e40ed9114ef549d99b.zip |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test/parallel/test-util-inspect.js')
-rw-r--r-- | test/parallel/test-util-inspect.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 5cd051299d..ad5f738a85 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1404,3 +1404,15 @@ util.inspect(process); const args = (function() { return arguments; })('a'); assert.strictEqual(util.inspect(args), "[Arguments] { '0': 'a' }"); } + +{ + // Test that a long linked list can be inspected without throwing an error. + const list = {}; + let head = list; + // The real cutoff value is closer to 1400 stack frames as of May 2018, + // but let's be generous here – even a linked listed of length 100k should be + // inspectable in some way. + for (let i = 0; i < 100000; i++) + head = head.next = {}; + util.inspect(list); +} |