@@ -22,17 +22,26 @@ var file = 'tmp/tempscript'+Math.random()+'.js',
2222 script = 'require(\'../../global.js\'); echo("-asdf", "111");' ; // test '-' bug (see issue #20)
2323shell . ShellString ( script ) . to ( file ) ;
2424child . exec ( JSON . stringify ( process . execPath ) + ' ' + file , function ( err , stdout ) {
25- assert . ok ( stdout === '-asdf 111\n' || stdout === '-asdf 111\nundefined\n' ) ; // 'undefined' for v0.4
25+ assert . equal ( stdout , '-asdf 111\n' ) ;
2626
27- // simple test with silent(true)
28- shell . mkdir ( '-p' , 'tmp' ) ;
29- var file = 'tmp/tempscript' + Math . random ( ) + '.js' ,
30- script = 'require(\'../../global.js\'); config.silent=true; echo(555);' ;
27+ // using null as an explicit argument doesn't crash the function
28+ file = 'tmp/tempscript' + Math . random ( ) + '.js' ;
29+ script = 'require(\'../../global.js\'); echo(null);' ;
3130 shell . ShellString ( script ) . to ( file ) ;
32- child . exec ( JSON . stringify ( process . execPath ) + ' ' + file , function ( err , stdout ) {
33- assert . ok ( stdout === '555\n' || stdout === '555\nundefined\n' ) ; // 'undefined' for v0.4
34-
35- theEnd ( ) ;
31+ child . exec ( JSON . stringify ( process . execPath ) + ' ' + file , function ( err , stdout , stderr ) {
32+ assert . equal ( stdout , 'null\n' ) ;
33+ assert . equal ( stderr , '' ) ;
34+
35+ // simple test with silent(true)
36+ shell . mkdir ( '-p' , 'tmp' ) ;
37+ var file = 'tmp/tempscript' + Math . random ( ) + '.js' ,
38+ script = 'require(\'../../global.js\'); config.silent=true; echo(555);' ;
39+ shell . ShellString ( script ) . to ( file ) ;
40+ child . exec ( JSON . stringify ( process . execPath ) + ' ' + file , function ( err , stdout ) {
41+ assert . equal ( stdout , '555\n' ) ;
42+
43+ theEnd ( ) ;
44+ } ) ;
3645 } ) ;
3746} ) ;
3847
0 commit comments