X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F20-each.t;h=5c337e7e8637244a4df177da9b9b039d04caf8c0;hb=f11c750a682c00f323f29b9fc94159462bdb6842;hp=dfc139b629bd2cce5e538113b35d5b5c603aa988;hpb=84976874ba7cc16560a20dc013ac336fb5aec4b5;p=perl%2Fmodules%2Frgit.git diff --git a/t/20-each.t b/t/20-each.t index dfc139b..5c337e7 100644 --- a/t/20-each.t +++ b/t/20-each.t @@ -7,7 +7,7 @@ use Cwd qw/cwd abs_path/; use File::Spec::Functions qw/catdir catfile/; use File::Temp qw/tempfile tempdir/; -use Test::More tests => 2 + 2 * 4 + 11 * (3 + 1 + 3 + 6); +use Test::More tests => 2 + 2 * 4 + 12 * (3 + 1 + 3 + 6); use App::Rgit::Utils qw/:codes/; use App::Rgit; @@ -89,7 +89,7 @@ is(grep({ ref eq 'ARRAY' } @expected), 3, 'all of them are array references'); @$_, map({ catdir($tmpdir, $_) } @{$_}[1 .. 3]), $tmpdir, - '^n' + '%n', '%x' ], @expected; sub try { @@ -99,12 +99,17 @@ sub try { git => abs_path('t/bin/git'), root => $tmpdir, cmd => $cmd, - args => [ abs_path($filename), $cmd, qw/^n ^g ^w ^b ^G ^W ^B ^R ^^n/ ], + args => [ abs_path($filename), $cmd, qw/%n %g %w %b %G %W %B %R %%n %x/ ], policy => $policy, ); isnt($ar, undef, "each $cmd has a defined object"); - my $exit = $ar->run; + 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 ]; @@ -116,8 +121,9 @@ sub try { SKIP: { skip 'didn\'t visited that repo' => 10 unless defined $r; + s/[\r\n]*$// for @$r; is($r->[$_], $e->[$_], "each $cmd argument $_ for repository $i is ok") - for 0 .. 9; + for 0 .. 10; } } }