Skip to content

Commit 0a1d0e0

Browse files
committed
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.
1 parent e2f151f commit 0a1d0e0

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*() {}), '[GeneratorFunction]');
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: [GeneratorFunction: a] }');
3742
assert.strictEqual(util.inspect({a: 1, b: 2}), '{ a: 1, b: 2 }');

0 commit comments

Comments
 (0)