Skip to content

Commit 4bd6c00

Browse files
committed
tidy
1 parent b9f9e23 commit 4bd6c00

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

t/01_run.t

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,17 +614,23 @@ subtest 'execute exeption handling' => sub {
614614
};
615615

616616
subtest 'SIG_CHLD handler in spawned process' => sub {
617-
my $simple_rwp = "$FindBin::Bin/data/simple_rwp.pl";
617+
my $simple_rwp = "$FindBin::Bin/data/simple_rwp.pl";
618618
my $sigchld_handler = "$FindBin::Bin/data/sigchld_handler.pl";
619619

620620
# use `perl <script>` here, as Github ci action place the used perl executable
621621
# somewhere like /opt/hostedtoolcache/perl/<version>/<arch>/bin/perl so
622622
# /usr/bin/perl wouldn't have all needed dependencies
623-
is( process(execute => 'perl')->args([$simple_rwp])->start()->wait_stop()->exit_status(), 0, 'simple_rwp.pl exit with 0');
623+
is(
624+
process(execute => 'perl')->args([$simple_rwp])->start()->wait_stop()
625+
->exit_status(),
626+
0,
627+
'simple_rwp.pl exit with 0'
628+
);
624629

625630
my $p = process(execute => $sigchld_handler);
626-
is( $p->start()->wait_stop()->exit_status(), 0, 'sigchld_handler.pl exit with 0');
627-
like( $p->read_all_stdout, qr/SIG_CHLD/, "SIG_CHLD handler was executed");
631+
is($p->start()->wait_stop()->exit_status(),
632+
0, 'sigchld_handler.pl exit with 0');
633+
like($p->read_all_stdout, qr/SIG_CHLD/, "SIG_CHLD handler was executed");
628634
};
629635

630636
done_testing;

t/02_parallel_error_check.t

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ use lib ("$FindBin::Bin/lib", "../lib", "lib");
1010
use Mojo::IOLoop::ReadWriteProcess qw(parallel batch process pool);
1111

1212
sub check_error {
13-
my ($c, $nproc) = @_;
14-
my ($package, $filename, $line) = caller;
15-
my $msg = "$package, $filename:$line";
16-
my @errors = $c->error;
17-
is scalar(@errors), $nproc , "$msg check error nr";
18-
19-
for my $e (@errors) {
20-
is (scalar(@$e) , 0 , "$msg errors are zero");
21-
is (join("", @$e), "", "$msg errors are empty");
22-
}
13+
my ($c, $nproc) = @_;
14+
my ($package, $filename, $line) = caller;
15+
my $msg = "$package, $filename:$line";
16+
my @errors = $c->error;
17+
is scalar(@errors), $nproc, "$msg check error nr";
18+
19+
for my $e (@errors) {
20+
is(scalar(@$e), 0, "$msg errors are zero");
21+
is(join("", @$e), "", "$msg errors are empty");
22+
}
2323
}
2424

2525
subtest parallel => sub {
@@ -92,7 +92,7 @@ subtest batch => sub {
9292
separate_err => 0,
9393
set_pipes => 1
9494
);
95-
$n_proc ++;
95+
$n_proc++;
9696
$c->start();
9797
check_error $c, $n_proc;
9898
is $c->last->getline, "Hello world 3\n";
@@ -102,7 +102,7 @@ subtest batch => sub {
102102

103103
my $result;
104104
$c->add(code => sub { return 40 + 2 }, separate_err => 0, set_pipes => 0);
105-
$n_proc ++;
105+
$n_proc++;
106106
check_error $c, $n_proc;
107107
$c->last->on(
108108
stop => sub {

t/data/sigchld_handler.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
my $collected_pid = -1;
77
$SIG{CHLD} = sub {
8-
$collected_pid = waitpid(-1, 0);
9-
print "SIG_CHLD $collected_pid exit:" . ( $?>>8) . "\n";
8+
$collected_pid = waitpid(-1, 0);
9+
print "SIG_CHLD $collected_pid exit:" . ($? >> 8) . "\n";
1010
};
1111

1212
my $pid = fork();
@@ -15,6 +15,6 @@
1515
exit 0;
1616
}
1717
print "Forked child is $pid\n";
18-
sleep 0.1 while($collected_pid != $pid);
18+
sleep 0.1 while ($collected_pid != $pid);
1919
print "Exit graceful\n";
2020
exit 0;

0 commit comments

Comments
 (0)