Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

err.js 710B

1234567891011121314151617181920212223242526272829
  1. var inspect = require('../');
  2. var test = require('tape');
  3. test('type error', function (t) {
  4. t.plan(1);
  5. var aerr = new TypeError;
  6. aerr.foo = 555;
  7. aerr.bar = [1,2,3];
  8. var berr = new TypeError('tuv');
  9. berr.baz = 555;
  10. var cerr = new SyntaxError;
  11. cerr.message = 'whoa';
  12. cerr['a-b'] = 5;
  13. var obj = [
  14. new TypeError,
  15. new TypeError('xxx'),
  16. aerr, berr, cerr
  17. ];
  18. t.equal(inspect(obj), '[ ' + [
  19. '[TypeError]',
  20. '[TypeError: xxx]',
  21. '{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }',
  22. '{ [TypeError: tuv] baz: 555 }',
  23. '{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }'
  24. ].join(', ') + ' ]');
  25. });