7 use File::Temp qw<tempfile>;
14 use App::Rgit::TestUtils qw<can_run_git>;
16 my ($can_run, $reason) = can_run_git;
20 plan skip_all => "Can't run the mock git executable on this system: $reason";
24 ([ [ qw<%n %g %w %b %%> ] ]) x 5
27 local $ENV{GIT_DIR} = 't';
28 local $ENV{GIT_EXEC_PATH} = 't/bin/git';
30 for my $cmd (qw<daemon gui help init version>) {
31 my ($fh, $filename) = tempfile(UNLINK => 1);
33 my $ar = App::Rgit->new(
34 git => $ENV{GIT_EXEC_PATH},
35 root => $ENV{GIT_DIR},
37 args => [ abs_path($filename), $cmd, qw<%n %g %w %b %%> ],
39 isa_ok $ar, 'App::Rgit', "once $cmd is an App::Rgit object";
42 is $exit, 0, "once $cmd returned 0";
44 my @lines = sort split /\n/, do { local $/; <$fh> };
45 is @lines, 1, "once $cmd visited only one repo";
47 my $r = [ split /\|/, defined $lines[0] ? $lines[0] : '' ];
48 my $e = [ $cmd, qw<%n %g %w %b %%> ];
51 is $r->[$_], $e->[$_], "once $cmd argument $_ is ok";