X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F20-each.t;h=ea70268904f03bc49d9881b9eb82876e16bcf728;hb=dc668e3c302569ed2b5eb2ed893247308f22528a;hp=9332cb9cd79635b869f00e9a730c58dacb0641c0;hpb=cbafb1b35c3e76d6a7cf1628c83f08e64d3f3c5c;p=perl%2Fmodules%2Frgit.git diff --git a/t/20-each.t b/t/20-each.t index 9332cb9..ea70268 100644 --- a/t/20-each.t +++ b/t/20-each.t @@ -12,6 +12,10 @@ use Test::More tests => 2 + 2 * 4 + 12 * (3 + 1 + 3 + 6); use App::Rgit::Utils qw/:codes/; use App::Rgit; +use lib 't/lib'; + +use App::Rgit::Policy::Callback; + sub build { my ($tree, $prefix) = @_; my @ret; @@ -89,17 +93,21 @@ is(grep({ ref eq 'ARRAY' } @expected), 3, 'all of them are array references'); @$_, map({ catdir($tmpdir, $_) } @{$_}[1 .. 3]), $tmpdir, - '@n', '@x' + '%n', '%x' ], @expected; sub try { - my ($cmd, $exp, $policy) = @_; + my ($cmd, $exp) = @_; my ($fh, $filename) = tempfile(UNLINK => 1); + my $policy = App::Rgit::Policy->new( + @_ > 2 ? (name => 'Callback', callback => $_[2]) + : (name => 'Default') + ); my $ar = App::Rgit->new( 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 @x/ ], + 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"); @@ -121,6 +129,7 @@ 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 .. 10; }