line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
129548
|
use warnings; |
|
15
|
|
|
|
|
130
|
|
|
15
|
|
|
|
|
792
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Git::Hooks::Test; |
4
|
|
|
|
|
|
|
# ABSTRACT: Git::Hooks testing utilities |
5
|
|
|
|
|
|
|
$Git::Hooks::Test::VERSION = '3.3.1'; |
6
|
|
|
|
|
|
|
## no critic (RequireExplicitPackage) |
7
|
|
|
|
|
|
|
## no critic (ErrorHandling::RequireCarping) |
8
|
15
|
|
|
15
|
|
164
|
use v5.16.0; |
|
15
|
|
|
|
|
47
|
|
9
|
15
|
|
|
15
|
|
8950
|
use utf8; |
|
15
|
|
|
|
|
208
|
|
|
15
|
|
|
|
|
73
|
|
10
|
15
|
|
|
15
|
|
461
|
use Carp; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
1415
|
|
11
|
15
|
|
|
15
|
|
99
|
use Config; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
505
|
|
12
|
15
|
|
|
15
|
|
64
|
use Exporter qw/import/; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
529
|
|
13
|
15
|
|
|
15
|
|
12011
|
use Path::Tiny; |
|
15
|
|
|
|
|
217616
|
|
|
15
|
|
|
|
|
930
|
|
14
|
15
|
|
|
15
|
|
9896
|
use Git::Repository 'GitHooks'; |
|
15
|
|
|
|
|
710574
|
|
|
15
|
|
|
|
|
73
|
|
15
|
15
|
|
|
15
|
|
14590
|
use Test::More; |
|
15
|
|
|
|
|
857569
|
|
|
15
|
|
|
|
|
218
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
18
|
|
|
|
|
|
|
install_hooks |
19
|
|
|
|
|
|
|
new_commit |
20
|
|
|
|
|
|
|
newdir |
21
|
|
|
|
|
|
|
new_repos |
22
|
|
|
|
|
|
|
test_command |
23
|
|
|
|
|
|
|
test_nok |
24
|
|
|
|
|
|
|
test_nok_match |
25
|
|
|
|
|
|
|
test_ok |
26
|
|
|
|
|
|
|
test_ok_match |
27
|
|
|
|
|
|
|
/; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
30
|
|
|
|
|
|
|
all => \@EXPORT_OK |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Make sure the git messages come in English. (LC_ALL) |
34
|
|
|
|
|
|
|
# Eliminate the effects of system wide (GIT_CONFIG_NOSYSTEM) |
35
|
|
|
|
|
|
|
# and global configuration (XDG_CONFIG_HOME and HOME). |
36
|
|
|
|
|
|
|
# https://metacpan.org/dist/Git-Repository/view/lib/Git/Repository/Tutorial.pod#Ignore-the-system-and-global-configuration-files |
37
|
|
|
|
|
|
|
my %git_test_env = ( |
38
|
|
|
|
|
|
|
LC_ALL => 'C', |
39
|
|
|
|
|
|
|
GIT_CONFIG_NOSYSTEM => 1, |
40
|
|
|
|
|
|
|
XDG_CONFIG_HOME => undef, |
41
|
|
|
|
|
|
|
HOME => undef, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $cwd = Path::Tiny->cwd; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# It's better to perform all tests in a temporary directory because |
47
|
|
|
|
|
|
|
# otherwise the author runs the risk of messing with its local |
48
|
|
|
|
|
|
|
# Git::Hooks git repository. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $T = Path::Tiny->tempdir( |
51
|
|
|
|
|
|
|
TEMPLATE => 'githooks.XXXXX', |
52
|
|
|
|
|
|
|
TMPDIR => 1, |
53
|
|
|
|
|
|
|
CLEANUP => exists $ENV{REPO_CLEANUP} ? $ENV{REPO_CLEANUP} : 1, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
chdir $T or croak "Can't chdir $T: $!"; |
57
|
14
|
|
|
14
|
|
117678
|
END { chdir '/' } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $tmpldir = $T->child('templates'); |
60
|
|
|
|
|
|
|
mkdir $tmpldir, 0777 or BAIL_OUT("can't mkdir $tmpldir: $!"); |
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
my $hooksdir = $tmpldir->child('hooks'); |
63
|
|
|
|
|
|
|
mkdir $hooksdir, 0777 or BAIL_OUT("can't mkdir $hooksdir: $!"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $git_version = eval { Git::Repository->version } || 'unknown'; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub newdir { |
69
|
0
|
|
|
0
|
0
|
0
|
my $num = 1 + Test::Builder->new()->current_test(); |
70
|
0
|
|
|
|
|
0
|
my $dir = $T->child($num); |
71
|
0
|
|
|
|
|
0
|
mkdir $dir; |
72
|
0
|
|
|
|
|
0
|
return $dir; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub install_hooks { |
76
|
32
|
|
|
32
|
0
|
126767
|
my ($git, $extra_perl, @hooks) = @_; |
77
|
32
|
|
|
|
|
479
|
my $hooks_dir = path($git->git_dir())->child('hooks'); |
78
|
32
|
|
|
|
|
5668
|
my $hook_pl = $hooks_dir->child('hook.pl'); |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
## no critic (RequireBriefOpen) |
81
|
32
|
50
|
|
|
|
1390
|
open my $fh, '>', $hook_pl or BAIL_OUT("Can't create $hook_pl: $!"); |
|
32
|
|
|
|
|
838
|
|
82
|
32
|
50
|
|
|
|
3716
|
state $debug = $ENV{DBG} ? '-d' : ''; |
83
|
32
|
|
|
|
|
193
|
state $bliblib = $cwd->child('blib', 'lib'); |
84
|
32
|
|
|
|
|
3888
|
print $fh <<"EOS"; |
85
|
|
|
|
|
|
|
#!$Config{perlpath} $debug |
86
|
|
|
|
|
|
|
use strict; |
87
|
|
|
|
|
|
|
use warnings; |
88
|
|
|
|
|
|
|
use lib '$bliblib'; |
89
|
|
|
|
|
|
|
EOS |
90
|
|
|
|
|
|
|
|
91
|
32
|
50
|
|
|
|
718
|
state $pathsep = $^O eq 'MSWin32' ? ';' : ':'; |
92
|
32
|
50
|
33
|
|
|
487
|
if (defined $ENV{PERL5LIB} and length $ENV{PERL5LIB}) { |
93
|
32
|
|
|
|
|
901
|
foreach my $path (reverse split "$pathsep", $ENV{PERL5LIB}) { |
94
|
64
|
50
|
|
|
|
364
|
say $fh "use lib '$path';" if $path; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
32
|
|
|
|
|
124
|
print $fh <<'EOS'; |
99
|
|
|
|
|
|
|
use Git::Hooks; |
100
|
|
|
|
|
|
|
EOS |
101
|
|
|
|
|
|
|
|
102
|
32
|
100
|
|
|
|
167
|
print $fh $extra_perl if defined $extra_perl; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Not all hooks defined the GIT_DIR environment variable |
105
|
|
|
|
|
|
|
# (e.g., pre-rebase doesn't). |
106
|
32
|
|
|
|
|
108
|
print $fh <<'EOS'; |
107
|
|
|
|
|
|
|
$ENV{GIT_DIR} = '.git' unless exists $ENV{GIT_DIR}; |
108
|
|
|
|
|
|
|
$ENV{GIT_CONFIG} = "$ENV{GIT_DIR}/config"; |
109
|
|
|
|
|
|
|
EOS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Hooks on Windows are invoked indirectly. |
112
|
32
|
50
|
|
|
|
213
|
if ($^O eq 'MSWin32') { |
113
|
0
|
|
|
|
|
0
|
print $fh <<'EOS'; |
114
|
|
|
|
|
|
|
my $hook = shift; |
115
|
|
|
|
|
|
|
run_hook($hook, @ARGV); |
116
|
|
|
|
|
|
|
EOS |
117
|
|
|
|
|
|
|
} else { |
118
|
32
|
|
|
|
|
1622
|
print $fh <<'EOS'; |
119
|
|
|
|
|
|
|
run_hook($0, @ARGV); |
120
|
|
|
|
|
|
|
EOS |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
32
|
|
|
|
|
319
|
chmod 0755 => $hook_pl; |
124
|
|
|
|
|
|
|
|
125
|
32
|
100
|
|
|
|
1017
|
@hooks = qw/ applypatch-msg pre-applypatch post-applypatch |
126
|
|
|
|
|
|
|
pre-commit prepare-commit-msg commit-msg |
127
|
|
|
|
|
|
|
post-commit pre-rebasen post-checkout post-merge |
128
|
|
|
|
|
|
|
pre-push pre-receive update post-receive post-update |
129
|
|
|
|
|
|
|
push-to-checkout pre-auto-gc post-rewrite |
130
|
|
|
|
|
|
|
/ unless @hooks; |
131
|
|
|
|
|
|
|
|
132
|
32
|
|
|
|
|
153
|
foreach my $hook (@hooks) { |
133
|
77
|
|
|
|
|
2423
|
my $hookfile = $hooks_dir->child($hook); |
134
|
77
|
50
|
|
|
|
3765
|
if ($^O eq 'MSWin32') { |
135
|
0
|
|
|
|
|
0
|
(my $perl = $^X) =~ tr:\\:/:; |
136
|
0
|
|
|
|
|
0
|
$hook_pl =~ tr:\\:/:; |
137
|
0
|
0
|
|
|
|
0
|
my $d = $ENV{DBG} ? '-d' : ''; |
138
|
0
|
|
|
|
|
0
|
my $script = <<"EOS"; |
139
|
|
|
|
|
|
|
#!/bin/sh |
140
|
|
|
|
|
|
|
$perl $d $hook_pl $hook \"\$@\" |
141
|
|
|
|
|
|
|
EOS |
142
|
0
|
0
|
|
|
|
0
|
path($hookfile)->spew($script) |
143
|
|
|
|
|
|
|
or BAIL_OUT("can't path('$hookfile')->spew('$script')\n"); |
144
|
0
|
|
|
|
|
0
|
chmod 0755 => $hookfile; |
145
|
|
|
|
|
|
|
} else { |
146
|
77
|
|
|
|
|
424
|
$hookfile->remove; # in case we're replacing the hooks |
147
|
77
|
50
|
|
|
|
2832
|
symlink 'hook.pl', $hookfile |
148
|
|
|
|
|
|
|
or BAIL_OUT("can't symlink '$hooks_dir', '$hook': $!"); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
} |
151
|
32
|
|
|
|
|
1905
|
return; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub new_repos { |
155
|
22
|
|
|
22
|
0
|
134373
|
my $repodir = $T->child('repo'); |
156
|
22
|
|
|
|
|
3197
|
my $filename = $repodir->child('file.txt'); |
157
|
22
|
|
|
|
|
975
|
my $clonedir = $T->child('clone'); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# Remove the directories recursively to create new ones. |
160
|
22
|
|
|
|
|
1303
|
$repodir->remove_tree({safe => 0}); |
161
|
22
|
|
|
|
|
76294
|
$clonedir->remove_tree({safe => 0}); |
162
|
|
|
|
|
|
|
|
163
|
22
|
50
|
|
|
|
15954
|
mkdir $repodir, 0777 or BAIL_OUT("can't mkdir $repodir: $!"); |
164
|
|
|
|
|
|
|
{ |
165
|
22
|
50
|
|
|
|
2590
|
open my $fh, '>', $filename or croak BAIL_OUT("can't open $filename: $!"); |
|
22
|
|
|
|
|
344
|
|
166
|
22
|
|
|
|
|
1941
|
say $fh "first line"; |
167
|
22
|
|
|
|
|
3143
|
close $fh; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
22
|
|
|
|
|
207
|
my $stderr = $T->child('stderr'); |
171
|
|
|
|
|
|
|
|
172
|
22
|
|
|
|
|
1262
|
my @result = eval { |
173
|
22
|
|
|
|
|
145
|
Git::Repository->run(qw/-c init.defaultBranch=master init -q/, |
174
|
|
|
|
|
|
|
"--template=$tmpldir", $repodir, { env => \%git_test_env }); |
175
|
|
|
|
|
|
|
|
176
|
22
|
|
|
|
|
444801
|
my $repo = Git::Repository->new(work_tree => $repodir, |
177
|
|
|
|
|
|
|
{ env => \%git_test_env }); |
178
|
|
|
|
|
|
|
|
179
|
22
|
|
|
|
|
1018922
|
$repo->run(qw/config user.email myself@example.com/); |
180
|
22
|
|
|
|
|
313458
|
$repo->run(qw/config user.name/, 'My Self'); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
{ |
183
|
22
|
|
|
|
|
293929
|
my $cmd = Git::Repository->command( |
|
22
|
|
|
|
|
776
|
|
184
|
|
|
|
|
|
|
qw/clone -q --bare --no-hardlinks/, "--template=$tmpldir", $repodir, $clonedir, |
185
|
|
|
|
|
|
|
); |
186
|
|
|
|
|
|
|
|
187
|
22
|
|
|
|
|
250161
|
my $my_stderr = $cmd->stderr; |
188
|
|
|
|
|
|
|
|
189
|
22
|
50
|
|
|
|
1107
|
open my $err_h, '>', $T->child('stderr') |
190
|
0
|
|
|
|
|
0
|
or croak "Can't open '@{[$T->child('stderr')]}' for writing: $!\n"; |
191
|
22
|
|
|
|
|
201951
|
while (<$my_stderr>) { |
192
|
22
|
|
|
|
|
1067
|
$err_h->print($_); |
193
|
|
|
|
|
|
|
} |
194
|
22
|
|
|
|
|
26865
|
close $err_h; |
195
|
|
|
|
|
|
|
|
196
|
22
|
|
|
|
|
492
|
$cmd->close(); |
197
|
22
|
50
|
|
|
|
6222
|
croak "Can't git-clone $repodir into $clonedir" unless $cmd->exit() == 0; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
22
|
|
|
|
|
2301
|
my $clone = Git::Repository->new(git_dir => $clonedir); |
201
|
|
|
|
|
|
|
|
202
|
22
|
|
|
|
|
751387
|
$repo->run(qw/remote add clone/, $clonedir); |
203
|
|
|
|
|
|
|
|
204
|
22
|
|
|
|
|
338614
|
return ($repo, $filename, $clone, $T); |
205
|
|
|
|
|
|
|
}; |
206
|
|
|
|
|
|
|
|
207
|
22
|
50
|
|
|
|
285
|
if (my $E = $@) { |
208
|
0
|
|
|
|
|
0
|
my $exception = "$E"; # stringify it |
209
|
0
|
0
|
|
|
|
0
|
if (-s $stderr) { |
210
|
0
|
0
|
|
|
|
0
|
open my $err_h, '<', $stderr |
211
|
|
|
|
|
|
|
or croak "Can't open '$stderr' for reading: $!\n"; |
212
|
0
|
|
|
|
|
0
|
local $/ = undef; # slurp mode |
213
|
0
|
|
|
|
|
0
|
$exception .= 'STDERR='; |
214
|
0
|
|
|
|
|
0
|
$exception .= <$err_h>; |
215
|
0
|
|
|
|
|
0
|
close $err_h; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
# The BAIL_OUT function can't show a message with newlines |
219
|
|
|
|
|
|
|
# inside. So, we have to make sure to get rid of any. |
220
|
0
|
|
|
|
|
0
|
$exception =~ s/\n/;/g; |
221
|
0
|
|
|
|
|
0
|
local $, = ':'; |
222
|
0
|
|
|
|
|
0
|
BAIL_OUT("Error setting up repos for test: Exception='$exception'; CWD=$T; git-version=$git_version; \@INC=(@INC).\n"); |
223
|
0
|
|
|
|
|
0
|
@result = (); |
224
|
|
|
|
|
|
|
}; |
225
|
|
|
|
|
|
|
|
226
|
22
|
|
|
|
|
874
|
return @result; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub new_commit { |
230
|
13
|
|
|
13
|
0
|
516177
|
my ($git, $file, $msg) = @_; |
231
|
|
|
|
|
|
|
|
232
|
13
|
|
50
|
|
|
309
|
$file->append($msg || 'new commit'); |
233
|
|
|
|
|
|
|
|
234
|
13
|
|
|
|
|
5401
|
$git->run(add => $file); |
235
|
13
|
|
50
|
|
|
196311
|
$git->run(qw/commit -q -m/, $msg || 'commit'); |
236
|
|
|
|
|
|
|
|
237
|
13
|
|
|
|
|
1288124
|
return; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
# Executes a git command with arguments and return a four-elements |
242
|
|
|
|
|
|
|
# list containing: (a) a boolean indication of success, (b) the exit |
243
|
|
|
|
|
|
|
# code, (c) the command's STDOUT, and (d) the command's STDERR. |
244
|
|
|
|
|
|
|
sub test_command { |
245
|
202
|
|
|
202
|
0
|
749722
|
my ($git, $command, @args) = @_; |
246
|
|
|
|
|
|
|
|
247
|
202
|
|
|
|
|
1937
|
my $cmd = $git->command($command, @args); |
248
|
|
|
|
|
|
|
|
249
|
202
|
|
|
|
|
2443928
|
my $stdout = do { local $/ = undef; readline($cmd->stdout); }; |
|
202
|
|
|
|
|
1426
|
|
|
202
|
|
|
|
|
2647
|
|
250
|
202
|
|
|
|
|
52534325
|
my $stderr = do { local $/ = undef; readline($cmd->stderr); }; |
|
202
|
|
|
|
|
1978
|
|
|
202
|
|
|
|
|
4020
|
|
251
|
|
|
|
|
|
|
|
252
|
202
|
|
|
|
|
13667
|
$cmd->close; |
253
|
|
|
|
|
|
|
|
254
|
202
|
|
|
|
|
65628
|
return ($cmd->exit() == 0, $cmd->exit(), $stdout, $stderr); |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub test_ok { |
258
|
103
|
|
|
103
|
0
|
4611683
|
my ($testname, @args) = @_; |
259
|
103
|
|
|
|
|
1040
|
my ($ok, $exit, $stdout, $stderr) = test_command(@args); |
260
|
103
|
50
|
|
|
|
14754
|
if ($ok) { |
261
|
103
|
|
|
|
|
2244
|
pass($testname); |
262
|
|
|
|
|
|
|
} else { |
263
|
0
|
|
|
|
|
0
|
fail($testname); |
264
|
0
|
|
|
|
|
0
|
diag(" exit=$exit\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
265
|
|
|
|
|
|
|
} |
266
|
103
|
|
|
|
|
128217
|
return $ok; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub test_ok_match { |
270
|
3
|
|
|
3
|
0
|
49990
|
my ($testname, $regex, @args) = @_; |
271
|
3
|
|
|
|
|
38
|
my ($ok, $exit, $stdout, $stderr) = test_command(@args); |
272
|
3
|
50
|
|
|
|
346
|
if ($ok) { |
273
|
3
|
50
|
66
|
|
|
111
|
if ($stdout =~ $regex || $stderr =~ $regex) { |
274
|
3
|
|
|
|
|
58
|
pass($testname); |
275
|
|
|
|
|
|
|
} else { |
276
|
0
|
|
|
|
|
0
|
fail($testname); |
277
|
0
|
|
|
|
|
0
|
diag(" did not match regex ($regex)\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
} else { |
280
|
0
|
|
|
|
|
0
|
fail($testname); |
281
|
0
|
|
|
|
|
0
|
diag(" exit=$exit\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
282
|
|
|
|
|
|
|
} |
283
|
3
|
|
|
|
|
3124
|
return $ok; |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub test_nok { |
287
|
7
|
|
|
7
|
0
|
177666
|
my ($testname, @args) = @_; |
288
|
7
|
|
|
|
|
89
|
my ($ok, $exit, $stdout, $stderr) = test_command(@args); |
289
|
7
|
50
|
|
|
|
806
|
if ($ok) { |
290
|
0
|
|
|
|
|
0
|
fail($testname); |
291
|
0
|
|
|
|
|
0
|
diag(" succeeded without intention\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
292
|
|
|
|
|
|
|
} else { |
293
|
7
|
|
|
|
|
145
|
pass($testname); |
294
|
|
|
|
|
|
|
} |
295
|
7
|
|
|
|
|
7379
|
return !$ok; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub test_nok_match { |
299
|
78
|
|
|
78
|
0
|
4058085
|
my ($testname, $regex, @args) = @_; |
300
|
78
|
|
|
|
|
1028
|
my ($ok, $exit, $stdout, $stderr) = test_command(@args); |
301
|
78
|
50
|
33
|
|
|
15501
|
if ($ok) { |
|
|
50
|
|
|
|
|
|
302
|
0
|
|
|
|
|
0
|
fail($testname); |
303
|
0
|
|
|
|
|
0
|
diag(" succeeded without intention\n exit=$exit\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
304
|
0
|
|
|
|
|
0
|
return 0; |
305
|
|
|
|
|
|
|
} elsif ($stdout =~ $regex || $stderr =~ $regex) { |
306
|
78
|
|
|
|
|
1861
|
pass($testname); |
307
|
78
|
|
|
|
|
96196
|
return 1; |
308
|
|
|
|
|
|
|
} else { |
309
|
0
|
|
|
|
|
0
|
fail($testname); |
310
|
0
|
|
|
|
|
0
|
diag(" did not match regex ($regex)\n exit=$exit\n stdout=$stdout\n stderr=$stderr\n git-version=$git_version\n"); |
311
|
0
|
|
|
|
|
0
|
return 0; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
1; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
__END__ |