You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
636 B

4 years ago
  1. var test = require('tape');
  2. var hasSymbols = require('has-symbols')();
  3. var utilInspect = require('../util.inspect');
  4. var inspect = require('..');
  5. test('inspect', function (t) {
  6. t.plan(1);
  7. var obj = [{ inspect: function () { return '!XYZ¡'; } }, []];
  8. t.equal(inspect(obj), '[ !XYZ¡, [] ]');
  9. });
  10. test('inspect custom symbol', { skip: !hasSymbols || !utilInspect }, function (t) {
  11. t.plan(1);
  12. var obj = { inspect: function () { return 'string'; } };
  13. obj[utilInspect.custom] = function () { return 'symbol'; };
  14. t.equal(inspect([obj, []]), '[ ' + (utilInspect.custom ? 'symbol' : 'string') + ', [] ]');
  15. });