Skip to content

Commit 7acc482

Browse files
aqrlnjasnell
authored andcommitted
test: add arrow functions to test-util-inspect
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]>
1 parent 1faf136 commit 7acc482

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-util-inspect.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ assert.strictEqual(util.inspect(false), 'false');
3030
assert.strictEqual(util.inspect(''), "''");
3131
assert.strictEqual(util.inspect('hello'), "'hello'");
3232
assert.strictEqual(util.inspect(function() {}), '[Function]');
33+
assert.strictEqual(util.inspect(() => {}), '[Function]');
3334
assert.strictEqual(util.inspect(async function() {}), '[AsyncFunction]');
35+
assert.strictEqual(util.inspect(async () => {}), '[AsyncFunction]');
3436
assert.strictEqual(util.inspect(function*() {}), '[GeneratorFunction]');
3537
assert.strictEqual(util.inspect(undefined), 'undefined');
3638
assert.strictEqual(util.inspect(null), 'null');
@@ -51,8 +53,11 @@ assert.strictEqual(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]');
5153
assert.strictEqual(util.inspect({}), '{}');
5254
assert.strictEqual(util.inspect({a: 1}), '{ a: 1 }');
5355
assert.strictEqual(util.inspect({a: function() {}}), '{ a: [Function: a] }');
56+
assert.strictEqual(util.inspect({a: () => {}}), '{ a: [Function: a] }');
5457
assert.strictEqual(util.inspect({a: async function() {}}),
5558
'{ a: [AsyncFunction: a] }');
59+
assert.strictEqual(util.inspect({a: async () => {}}),
60+
'{ a: [AsyncFunction: a] }');
5661
assert.strictEqual(util.inspect({a: function*() {}}),
5762
'{ a: [GeneratorFunction: a] }');
5863
assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');

0 commit comments

Comments
 (0)