Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

fn.js 693B

12345678910111213141516171819202122232425262728
  1. var inspect = require('../');
  2. var test = require('tape');
  3. test('function', function (t) {
  4. t.plan(1);
  5. var obj = [ 1, 2, function f (n) {}, 4 ];
  6. t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
  7. });
  8. test('function name', function (t) {
  9. t.plan(1);
  10. var f = (function () {
  11. return function () {};
  12. }());
  13. f.toString = function () { return 'function xxx () {}' };
  14. var obj = [ 1, 2, f, 4 ];
  15. t.equal(inspect(obj), '[ 1, 2, [Function: xxx], 4 ]');
  16. });
  17. test('anon function', function (t) {
  18. var f = (function () {
  19. return function () {};
  20. }());
  21. var obj = [ 1, 2, f, 4 ];
  22. t.equal(inspect(obj), '[ 1, 2, [Function], 4 ]');
  23. t.end();
  24. });