-
Notifications
You must be signed in to change notification settings - Fork 27
/
08-status.t
executable file
·52 lines (37 loc) · 1.6 KB
/
08-status.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! perl
use 5.014; # strict, unicode_strings
use warnings;
use autodie;
use lib 't/lib';
use Test::BASE;
use Test::More;
use App::Cmd::Tester;
use App::GitGot;
my( $config , $dir ) = Test::BASE::write_fake_config();
$ENV{GITGOT_FAKE_GIT_WRAPPER} = 1;
{
my $result = test_app( 'App::GitGot' => [ 'status' , '-f' , $config , '-C' ]);
like $result->stdout , qr|1\)\s+bar\.git\s+\:\s+OK| , 'repo 1';
like $result->stdout , qr|3\)\s+foo\.git\s+\:\s+ERROR: repo 'foo.git' does not exist| , 'repo 3';
like $result->stdout , qr|4\)\s+xxx\.git\s+\:\s+OK| , 'repo 4';
is $result->stderr , '' , 'nothing on STDERR';
is $result->exit_code , 0 , 'exit with 0';
}
{
my $result = test_app( 'App::GitGot' => [ 'status' , '-f' , $config , '-C' , '-v' ]);
like $result->stdout , qr|1\)\s+bar\.git\s+\:\s+OK| , 'repo 1';
like $result->stdout , qr|3\)\s+foo\.git\s+\:\s+ERROR: repo 'foo.git' does not exist| , 'repo 3';
like $result->stdout , qr|4\)\s+xxx\.git\s+\:\s+OK| , 'repo 4';
is $result->stderr , '' , 'nothing on STDERR';
is $result->exit_code , 0 , 'exit with 0';
}
{
my $result = test_app( 'App::GitGot' => [ 'status' , '-f' , $config , '-C' , '--show-branch' ]);
like $result->stdout , qr|1\)\s+bar\.git\s+\:\s+OK\s+\[1\]| , 'repo 1';
like $result->stdout , qr|3\)\s+foo\.git\s+\:\s+ERROR: repo 'foo.git' does not exist| , 'repo 3';
like $result->stdout , qr|4\)\s+xxx\.git\s+\:\s+OK\s\[1\]| , 'repo 4';
is $result->stderr , '' , 'nothing on STDERR';
is $result->exit_code , 0 , 'exit with 0';
}
chdir('/'); ## clean up temp files
done_testing();