From: Jennie 'Seven' Evers-Corvina Date: Mon, 13 Dec 2010 19:18:21 +0000 (-0800) Subject: something's wrong, something's wronggit add t/scratch.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6ac47b9cff2cdd81cb82f93dc721c00013719608;p=p5sagit%2FIPC-PerlSSH-MultiHop.git something's wrong, something's wronggit add t/scratch.t --- diff --git a/t/scratch.t b/t/scratch.t index e6b13c4..bec3196 100644 --- a/t/scratch.t +++ b/t/scratch.t @@ -32,7 +32,7 @@ use Test::More; my $readfunc = sub { sysread( $read, $_[0], $_[1] ) }; my $writefunc = sub { syswrite( $write, $_[0] ) }; - IPC::PerlSSH->new( Readfunc => $readfunc, Writefunc => $writefunc ); + ($command, IPC::PerlSSH->new( Readfunc => $readfunc, Writefunc => $writefunc )); } @@ -43,9 +43,9 @@ $ssh->login('test', 'test'); my $pipc = Net::SSH::Perl::ProxiedIPC->new(ssh => $ssh); -my $perlssh = $pipc->_open_perlssh; +my ($cmd, $perlssh) = $pipc->_open_perlssh; -is( ref $perlssh, "IPC::PerlSSH", '$perlssh isa IPC::PerlSSH' ); +is( ref $perlssh, "IPC::PerlSSH", "\$perlssh isa IPC::PerlSSH (via $cmd)" ); $perlssh->eval( "use POSIX qw(uname)" ); my @remote_uname = $perlssh->eval( "uname()" ); @@ -61,4 +61,12 @@ $perlssh->eval( "use File::HomeDir" ); my $homedir2 = $perlssh->eval( 'File::HomeDir->my_home' ); is( $homedir2, "/home/test", 'got $ENV{HOME} the smart way' ); +my @test_hosts = [ 'stagetwo@localhost', 'stagethree@localhost' ]; +my ($cmd2, $pssh2) = $pipc->_open_perlssh(@test_hosts); +is( ref $pssh2, "IPC::PerlSSH", "\$pssh2 isa IPC::PerlSSH (via $cmd2)" ); + +$pssh2->eval( "use POSIX qw(uname)" ); +@remote_uname = $pssh2->eval( "uname()" ); +is( $remote_uname[1], "minerva", 'uname() returns minerva three jumps into localhost!' ); + done_testing;