Skip to content

Commit

Permalink
test: add arrow functions to test-util-inspect
Browse files Browse the repository at this point in the history
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: #11781
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
  • Loading branch information
aqrln authored and jasnell committed Mar 15, 2017
1 parent 1faf136 commit 7acc482
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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*() {}), '[GeneratorFunction]');
assert.strictEqual(util.inspect(undefined), 'undefined');
assert.strictEqual(util.inspect(null), 'null');
Expand All @@ -51,8 +53,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: [GeneratorFunction: a] }');
assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');
Expand Down

0 comments on commit 7acc482

Please sign in to comment.