@ -31,67 +31,67 @@ d.on('error', function(er) {
switch ( er_message ) {
case 'emitted' :
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainEmitter , e ) ;
assert . e qual( er . domainThrown , false ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainEmitter , e ) ;
assert . strictE qual( er . domainThrown , false ) ;
break ;
case 'bound' :
assert . ok ( ! er . domainEmitter ) ;
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainBound , fn ) ;
assert . e qual( er . domainThrown , false ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainBound , fn ) ;
assert . strictE qual( er . domainThrown , false ) ;
break ;
case 'thrown' :
assert . ok ( ! er . domainEmitter ) ;
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainThrown , true ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainThrown , true ) ;
break ;
case "ENOENT: no such file or directory, open 'this file does not exist'" :
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainThrown , false ) ;
assert . e qual( typeof er . domainBound , 'function' ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainThrown , false ) ;
assert . strictE qual( typeof er . domainBound , 'function' ) ;
assert . ok ( ! er . domainEmitter ) ;
assert . e qual( er . code , 'ENOENT' ) ;
assert . e qual( er_path , 'this file does not exist' ) ;
assert . e qual( typeof er . errno , 'number' ) ;
assert . strictE qual( er . code , 'ENOENT' ) ;
assert . strictE qual( er_path , 'this file does not exist' ) ;
assert . strictE qual( typeof er . errno , 'number' ) ;
break ;
case
"ENOENT: no such file or directory, open 'stream for nonexistent file'" :
assert . e qual( typeof er . errno , 'number' ) ;
assert . e qual( er . code , 'ENOENT' ) ;
assert . e qual( er_path , 'stream for nonexistent file' ) ;
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainEmitter , fst ) ;
assert . strictE qual( typeof er . errno , 'number' ) ;
assert . strictE qual( er . code , 'ENOENT' ) ;
assert . strictE qual( er_path , 'stream for nonexistent file' ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainEmitter , fst ) ;
assert . ok ( ! er . domainBound ) ;
assert . e qual( er . domainThrown , false ) ;
assert . strictE qual( er . domainThrown , false ) ;
break ;
case 'implicit' :
assert . e qual( er . domainEmitter , implicit ) ;
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainThrown , false ) ;
assert . strictE qual( er . domainEmitter , implicit ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainThrown , false ) ;
assert . ok ( ! er . domainBound ) ;
break ;
case 'implicit timer' :
assert . e qual( er . domain , d ) ;
assert . e qual( er . domainThrown , true ) ;
assert . strictE qual( er . domain , d ) ;
assert . strictE qual( er . domainThrown , true ) ;
assert . ok ( ! er . domainEmitter ) ;
assert . ok ( ! er . domainBound ) ;
break ;
case 'Cannot read property \'isDirectory\' of undefined' :
assert . e qual( er . domain , d ) ;
assert . strictE qual( er . domain , d ) ;
assert . ok ( ! er . domainEmitter ) ;
assert . ok ( ! er . domainBound ) ;
break ;
case 'nextTick execution loop' :
assert . e qual( er . domain , d ) ;
assert . strictE qual( er . domain , d ) ;
assert . ok ( ! er . domainEmitter ) ;
assert . ok ( ! er . domainBound ) ;
break ;
@ -107,7 +107,8 @@ d.on('error', function(er) {
process . on ( 'exit' , function ( ) {
console . error ( 'exit' , caught , expectCaught ) ;
assert . equal ( caught , expectCaught , 'caught the expected number of errors' ) ;
assert . strictEqual ( caught , expectCaught ,
'caught the expected number of errors' ) ;
console . log ( 'ok' ) ;
} ) ;
@ -172,7 +173,7 @@ expectCaught++;
// intercepted should never pass first argument to callback
function fn2 ( data ) {
assert . e qual( data , 'data' , 'should not be null err argument' ) ;
assert . strictE qual( data , 'data' , 'should not be null err argument' ) ;
}
bound = d . intercept ( fn2 ) ;
@ -181,8 +182,8 @@ bound(null, 'data');
// intercepted should never pass first argument to callback
// even if arguments length is more than 2.
function fn3 ( data , data2 ) {
assert . e qual( data , 'data' , 'should not be null err argument' ) ;
assert . e qual( data2 , 'data2' , 'should not be data argument' ) ;
assert . strictE qual( data , 'data' , 'should not be null err argument' ) ;
assert . strictE qual( data2 , 'data2' , 'should not be data argument' ) ;
}
bound = d . intercept ( fn3 ) ;
@ -225,14 +226,14 @@ expectCaught++;
var result = d . run ( function ( ) {
return 'return value' ;
} ) ;
assert . e qual( result , 'return value' ) ;
assert . strictE qual( result , 'return value' ) ;
// check if the executed function take in count the applied parameters
result = d . run ( function ( a , b ) {
return a + ' ' + b ;
} , 'return' , 'value' ) ;
assert . e qual( result , 'return value' ) ;
assert . strictE qual( result , 'return value' ) ;
var fst = fs . createReadStream ( 'stream for nonexistent file' ) ;