MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/.trash/node_modules/object-inspect/test/fn.js
var inspect = require('../');
var test = require('tape');

test('function', function (t) {
    t.plan(1);
    var obj = [ 1, 2, function f (n) {}, 4 ];
    t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
});

test('function name', function (t) {
    t.plan(1);
    var f = (function () {
      return function () {};
    }());
    f.toString = function () { return 'function xxx () {}' };
    var obj = [ 1, 2, f, 4 ];
    t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]');
});

test('anon function', function (t) {
    var f = (function () {
      return function () {};
    }());
    var obj = [ 1, 2, f, 4 ];
    t.equal(inspect(obj), '[ 1, 2, [Function], 4 ]');

    t.end();
});