diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-07-25 09:06:26 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-08-02 15:00:59 +0200 |
commit | 1b24b37299a15722c11deeb4b663ba39cdc38d09 (patch) | |
tree | f3c0fb51f70a2b9ecf8c61f86f7f3bcc0d848224 /test | |
parent | 80b10b4fe24874d9155980b608b3b49fd5a43ea8 (diff) | |
download | node-new-1b24b37299a15722c11deeb4b663ba39cdc38d09.tar.gz |
util: fix formatting of objects with SIMD enabled
When SIMD is enabled, `util.format` couldn’t display objects
(with at least 1 key) because the formatter function got
overridden.
PR-URL: https://github.com/nodejs/node/pull/7864
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-util-format.js | 2 | ||||
-rw-r--r-- | test/parallel/test-util-inspect-simd.js | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index f3702ef2f0..b8977e57b5 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -7,7 +7,9 @@ const symbol = Symbol('foo'); assert.equal(util.format(), ''); assert.equal(util.format(''), ''); assert.equal(util.format([]), '[]'); +assert.equal(util.format([0]), '[ 0 ]'); assert.equal(util.format({}), '{}'); +assert.equal(util.format({foo: 42}), '{ foo: 42 }'); assert.equal(util.format(null), 'null'); assert.equal(util.format(true), 'true'); assert.equal(util.format(false), 'false'); diff --git a/test/parallel/test-util-inspect-simd.js b/test/parallel/test-util-inspect-simd.js index 752ea3d0ce..ec4ccc1875 100644 --- a/test/parallel/test-util-inspect-simd.js +++ b/test/parallel/test-util-inspect-simd.js @@ -59,3 +59,12 @@ if (typeof SIMD.Uint8x16 === 'function') { inspect(SIMD.Uint8x16()), 'Uint8x16 [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]'); } + +// Tests from test-inspect.js that should not fail with --harmony_simd. +assert.strictEqual(inspect([]), '[]'); +assert.strictEqual(inspect([0]), '[ 0 ]'); +assert.strictEqual(inspect({}), '{}'); +assert.strictEqual(inspect({foo: 42}), '{ foo: 42 }'); +assert.strictEqual(inspect(null), 'null'); +assert.strictEqual(inspect(true), 'true'); +assert.strictEqual(inspect(false), 'false'); |