From d0667e814e8be53d329a9c7f4849996c192395c9 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 14 Apr 2019 21:37:03 +0200 Subject: util: improve function inspection This commit contains the following changes: 1) Add null prototype support for functions. 2) Safely detect async and generator functions. 3) Mark anonymous functions as such instead of just leaving out the name. PR-URL: https://github.com/nodejs/node/pull/27227 Reviewed-By: Joyee Cheung Reviewed-By: John-David Dalton Reviewed-By: Anto Aravinth Reviewed-By: Rich Trott --- test/parallel/test-assert.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/parallel/test-assert.js') diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 003e67b380..98f728acfa 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -289,7 +289,7 @@ testAssertionMessage(undefined, 'undefined'); testAssertionMessage(-Infinity, '-Infinity'); testAssertionMessage([1, 2, 3], '[\n+ 1,\n+ 2,\n+ 3\n+ ]'); testAssertionMessage(function f() {}, '[Function: f]'); -testAssertionMessage(function() {}, '[Function]'); +testAssertionMessage(function() {}, '[Function (anonymous)]'); testAssertionMessage(circular, '{\n+ x: [Circular],\n+ y: 1\n+ }'); testAssertionMessage({ a: undefined, b: null }, '{\n+ a: undefined,\n+ b: null\n+ }'); @@ -597,7 +597,7 @@ assert.throws( '\n' + '+ {}\n' + '- {\n' + - '- [Symbol(nodejs.util.inspect.custom)]: [Function],\n' + + '- [Symbol(nodejs.util.inspect.custom)]: [Function (anonymous)],\n' + "- loop: 'forever'\n" + '- }' }); -- cgit v1.2.3