From fe45a379e4d68186e81a75b2453136cc1d0b98c0 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Fri, 10 Mar 2017 05:00:04 +0200 Subject: [PATCH] test: add arrow functions to test-util-inspect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though arrow functions and ES5 anonymous functions are technically the same for util.js, it won't hurt to test both. The same goes for async functions. PR-URL: https://github.com/nodejs/node/pull/11781 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu --- test/parallel/test-util-inspect.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 91e48c26df6a77..2f32b0b6862b35 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -9,7 +9,9 @@ assert.strictEqual(util.inspect(false), 'false'); assert.strictEqual(util.inspect(''), "''"); assert.strictEqual(util.inspect('hello'), "'hello'"); assert.strictEqual(util.inspect(function() {}), '[Function]'); +assert.strictEqual(util.inspect(() => {}), '[Function]'); assert.strictEqual(util.inspect(async function() {}), '[AsyncFunction]'); +assert.strictEqual(util.inspect(async () => {}), '[AsyncFunction]'); assert.strictEqual(util.inspect(function*() {}), '[Function]'); assert.strictEqual(util.inspect(undefined), 'undefined'); assert.strictEqual(util.inspect(null), 'null'); @@ -30,8 +32,11 @@ assert.strictEqual(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]'); assert.strictEqual(util.inspect({}), '{}'); assert.strictEqual(util.inspect({a: 1}), '{ a: 1 }'); assert.strictEqual(util.inspect({a: function() {}}), '{ a: [Function: a] }'); +assert.strictEqual(util.inspect({a: () => {}}), '{ a: [Function: a] }'); assert.strictEqual(util.inspect({a: async function() {}}), '{ a: [AsyncFunction: a] }'); +assert.strictEqual(util.inspect({a: async () => {}}), + '{ a: [AsyncFunction: a] }'); assert.strictEqual(util.inspect({a: function*() {}}), '{ a: [Function: a] }'); assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');