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