File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,4 +540,24 @@ process';
540540' setting MOJO_PROCESS_DEBUG to 1 enables debug mode when executing external process' ;
541541};
542542
543+ subtest ' process_args' => sub {
544+ use Mojo::IOLoop::ReadWriteProcess;
545+ my $code = sub {
546+ shift ;
547+ print $_ .$/ for (@_ );
548+ };
549+
550+ my $p = Mojo::IOLoop::ReadWriteProcess-> new($code , args => ' 0' )-> start-> wait_stop();
551+ is($p -> read_all_stdout(), " 0$/ " , ' 1) False scalar value was given as args.' );
552+
553+ $p = Mojo::IOLoop::ReadWriteProcess-> new($code )-> args(' 0' )-> start-> wait_stop();
554+ is($p -> read_all_stdout(), " 0$/ " , ' 2) False scalar value was given as args.' );
555+
556+ $p = Mojo::IOLoop::ReadWriteProcess-> new($code , args => [(0..3)] )-> start-> wait_stop();
557+ is($p -> read_all_stdout(), " 0$/1$/2$/3$/ " , ' 1) Args given as arrayref.' );
558+
559+ $p = Mojo::IOLoop::ReadWriteProcess-> new($code )-> args([(0..3)])-> start-> wait_stop();
560+ is($p -> read_all_stdout(), " 0$/1$/2$/3$/ " , ' 2) Args given as arrayref.' );
561+ };
562+
543563done_testing;
You can’t perform that action at this time.
0 commit comments