Skip to content

Commit fe45a37

Browse files
aqrlnevanlucas
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 9bdf62f commit fe45a37

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-util-inspect.js

+5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ assert.strictEqual(util.inspect(false), 'false');
99
assert.strictEqual(util.inspect(''), "''");
1010
assert.strictEqual(util.inspect('hello'), "'hello'");
1111
assert.strictEqual(util.inspect(function() {}), '[Function]');
12+
assert.strictEqual(util.inspect(() => {}), '[Function]');
1213
assert.strictEqual(util.inspect(async function() {}), '[AsyncFunction]');
14+
assert.strictEqual(util.inspect(async () => {}), '[AsyncFunction]');
1315
assert.strictEqual(util.inspect(function*() {}), '[Function]');
1416
assert.strictEqual(util.inspect(undefined), 'undefined');
1517
assert.strictEqual(util.inspect(null), 'null');
@@ -30,8 +32,11 @@ assert.strictEqual(util.inspect([1, [2, 3]]), '[ 1, [ 2, 3 ] ]');
3032
assert.strictEqual(util.inspect({}), '{}');
3133
assert.strictEqual(util.inspect({a: 1}), '{ a: 1 }');
3234
assert.strictEqual(util.inspect({a: function() {}}), '{ a: [Function: a] }');
35+
assert.strictEqual(util.inspect({a: () => {}}), '{ a: [Function: a] }');
3336
assert.strictEqual(util.inspect({a: async function() {}}),
3437
'{ a: [AsyncFunction: a] }');
38+
assert.strictEqual(util.inspect({a: async () => {}}),
39+
'{ a: [AsyncFunction: a] }');
3540
assert.strictEqual(util.inspect({a: function*() {}}),
3641
'{ a: [Function: a] }');
3742
assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');

0 commit comments

Comments
 (0)