Commits

Diab Jerius committed 452f946

test for server command returning a non-zero exit code

Comments (0)

Files changed (2)

t/Hg/Lib/Server/Pipe/runcommand.t

 
 }
 
+sub failed : Tests {
+
+    my $self   = shift;
+
+    my ( $out, $err, $exit ) =  $self->run( [ 'fail' ] );
+
+    is ( $out, '', 'no output on failure' );
+    is ( $err, 'failed!', 'error output on failure' );
+    is ( $exit, 193, 'error code' );
+}
+
 sub no_L_handler : Tests {
 
     my $self   = shift;

t/lib/Server/Commands.pm

         !$server->write_chunk( 'o', $dir );
     },
 
+    fail => sub {
+
+        my ( $server, $cmd, @args ) = @_;
+
+        $server->write_chunk( 'e', 'failed!' );
+	return 193;
+    },
+
     echo_error => sub {
         my ( $server, $cmd, @args ) = @_;