diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-05-19 00:55:54 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-07-16 10:46:09 +0200 |
commit | db495896249b29a93d8013b5ee2067ecf87ed081 (patch) | |
tree | fbd6aef6130b6e23535ae48dd285ae73452d69ae /test/parallel/test-util-inspect.js | |
parent | df97126173918ad589c5ceb234204f66d0c5afac (diff) | |
download | android-node-v8-db495896249b29a93d8013b5ee2067ecf87ed081.tar.gz android-node-v8-db495896249b29a93d8013b5ee2067ecf87ed081.tar.bz2 android-node-v8-db495896249b29a93d8013b5ee2067ecf87ed081.zip |
console,util: avoid pair array generation in C++
Use a plain `[key, value, key, value]`-style list instead
of an array of pairs for inspecting collections.
This also fixes a bug with `console.table()` where
inspecting a non-key-value `MapIterator` would have
led to odd results.
PR-URL: https://github.com/nodejs/node/pull/20831
Refs: https://github.com/nodejs/node/pull/20719#discussion_r189342513
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-util-inspect.js')
-rw-r--r-- | test/parallel/test-util-inspect.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 1f05f4987e..f97ab95cde 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -447,13 +447,13 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324'); { const map = new Map(); map.set(1, 2); - const vals = previewEntries(map.entries()); + const [ vals ] = previewEntries(map.entries()); const valsOutput = []; for (const o of vals) { valsOutput.push(o); } - assert.strictEqual(util.inspect(valsOutput), '[ [ 1, 2 ] ]'); + assert.strictEqual(util.inspect(valsOutput), '[ 1, 2 ]'); } // Test for other constructors in different context. |