@@ -6,18 +6,22 @@ var repeat = require('string.prototype.repeat');
6
6
var inspect = require ( '..' ) ;
7
7
8
8
test ( '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¡' ; } } , [ ] ] ;
11
11
t . equal ( inspect ( obj ) , '[ !XYZ¡, [] ]' ) ;
12
+ t . equal ( inspect ( obj , { customInspect : true } ) , '[ !XYZ¡, [] ]' ) ;
13
+ t . equal ( inspect ( obj , { customInspect : false } ) , '[ { inspect: [Function: xyzInspect] }, [] ]' ) ;
12
14
} ) ;
13
15
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 ) ;
16
18
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' ; } ;
19
21
20
22
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] }, [] ]' ) ;
21
25
} ) ;
22
26
23
27
test ( 'maxStringLength' , function ( t ) {
0 commit comments