- isnt($ar, undef, "each $cmd has a defined object");
- my $exit = $ar->run;
- is($exit, 0, "each $cmd returned 0");
- my @lines = sort split /\n/, do { local $/; <$fh> };
- my $res = [ map [ split /\|/, $_ ], @lines ];
- my $exp = [ map [ $cmd, @$_ ], @expected ];
- is_deeply($res, $exp, "each $cmd did the right thing");
+ isa_ok $ar, 'App::Rgit', "each $cmd is an App::Rgit object";
+
+ my $exit;
+ my $fail = $cmd eq 'FAIL' ? 1 : 0;
+ if ($fail) {
+ ($exit, undef) = $ar->run;
+ } else {
+ $exit = $ar->run;
+ }
+ is $exit, $fail, "each $cmd returned $fail";
+
+ my @lines = split /\n/, do { local $/; <$fh> };
+ my $res = [ map [ split /\|/, $_ ], @lines ];
+ $exp = [ map [ $cmd, @$_ ], @$exp ];
+
+ for my $i (0 .. $#$exp) {
+ my $e = $exp->[$i];
+ my $r = shift @$res;
+ isnt $r, undef, "each $cmd visited repository $i";
+
+SKIP:
+ {
+ skip 'didn\'t visited that repo' => 11 unless defined $r;
+
+ s/[\r\n]*$// for @$r;
+ for (0 .. 10) {
+ is $r->[$_], $e->[$_], "each $cmd argument $_ for repository $i is ok";
+ }
+ }
+ }