@@ -21,7 +21,25 @@ test('inspect custom symbol', { skip: !hasSymbols || !utilInspect || !utilInspec
2121
2222 t . equal ( inspect ( [ obj , [ ] ] ) , '[ ' + ( utilInspect . custom ? 'symbol' : 'string' ) + ', [] ]' ) ;
2323 t . equal ( inspect ( [ obj , [ ] ] , { customInspect : true } ) , '[ ' + ( utilInspect . custom ? 'symbol' : 'string' ) + ', [] ]' ) ;
24- t . equal ( inspect ( [ obj , [ ] ] , { customInspect : false } ) , '[ { inspect: [Function: stringInspect] }, [] ]' ) ;
24+ t . equal (
25+ inspect ( [ obj , [ ] ] , { customInspect : false } ) ,
26+ '[ { inspect: [Function: stringInspect]' + ( utilInspect . custom ? ', [' + inspect ( utilInspect . custom ) + ']: [Function: custom]' : '' ) + ' }, [] ]'
27+ ) ;
28+ } ) ;
29+
30+ test ( 'symbols' , { skip : ! hasSymbols } , function ( t ) {
31+ t . plan ( 2 ) ;
32+
33+ var obj = { a : 1 } ;
34+ obj [ Symbol ( 'test' ) ] = 2 ;
35+ obj [ Symbol . iterator ] = 3 ;
36+ Object . defineProperty ( obj , Symbol ( 'non-enum' ) , {
37+ enumerable : false ,
38+ value : 4
39+ } ) ;
40+
41+ t . equal ( inspect ( obj ) , '{ a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }' , 'object with symbols' ) ;
42+ t . equal ( inspect ( [ obj , [ ] ] ) , '[ { a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }, [] ]' , 'object with symbols' ) ;
2543} ) ;
2644
2745test ( 'maxStringLength' , function ( t ) {
0 commit comments