@@ -6,18 +6,22 @@ var repeat = require('string.prototype.repeat');
66var inspect = require ( '..' ) ;
77
88test ( 'inspect' , function ( t ) {
9- t . plan ( 1 ) ;
10- var obj = [ { inspect : function ( ) { return '!XYZ¡' ; } } , [ ] ] ;
9+ t . plan ( 3 ) ;
10+ var obj = [ { inspect : function xyzInspect ( ) { return '!XYZ¡' ; } } , [ ] ] ;
1111 t . equal ( inspect ( obj ) , '[ !XYZ¡, [] ]' ) ;
12+ t . equal ( inspect ( obj , { customInspect : true } ) , '[ !XYZ¡, [] ]' ) ;
13+ t . equal ( inspect ( obj , { customInspect : false } ) , '[ { inspect: [Function: xyzInspect] }, [] ]' ) ;
1214} ) ;
1315
14- test ( 'inspect custom symbol' , { skip : ! hasSymbols || ! utilInspect } , function ( t ) {
15- t . plan ( 1 ) ;
16+ test ( 'inspect custom symbol' , { skip : ! hasSymbols || ! utilInspect || ! utilInspect . custom } , function ( t ) {
17+ t . plan ( 3 ) ;
1618
17- var obj = { inspect : function ( ) { return 'string' ; } } ;
18- obj [ utilInspect . custom ] = function ( ) { return 'symbol' ; } ;
19+ var obj = { inspect : function stringInspect ( ) { return 'string' ; } } ;
20+ obj [ utilInspect . custom ] = function custom ( ) { return 'symbol' ; } ;
1921
2022 t . equal ( inspect ( [ obj , [ ] ] ) , '[ ' + ( utilInspect . custom ? 'symbol' : 'string' ) + ', [] ]' ) ;
23+ t . equal ( inspect ( [ obj , [ ] ] , { customInspect : true } ) , '[ ' + ( utilInspect . custom ? 'symbol' : 'string' ) + ', [] ]' ) ;
24+ t . equal ( inspect ( [ obj , [ ] ] , { customInspect : false } ) , '[ { inspect: [Function: stringInspect] }, [] ]' ) ;
2125} ) ;
2226
2327test ( 'maxStringLength' , function ( t ) {
0 commit comments