tsh/test learn the cmp() function to make full output compares easier
This commit is contained in:
parent
fb332a6c76
commit
446bd19de7
|
@ -11,6 +11,7 @@ package Gitolite::Test;
|
|||
dump
|
||||
confreset
|
||||
confadd
|
||||
cmp
|
||||
);
|
||||
#>>>
|
||||
use Exporter 'import';
|
||||
|
@ -24,6 +25,7 @@ BEGIN {
|
|||
*{'try'} = \&Tsh::try;
|
||||
*{'put'} = \&Tsh::put;
|
||||
*{'text'} = \&Tsh::text;
|
||||
*{'cmp'} = \&Tsh::cmp;
|
||||
}
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -17,7 +17,7 @@ package Tsh;
|
|||
|
||||
use Exporter 'import';
|
||||
@EXPORT = qw(
|
||||
try run AUTOLOAD
|
||||
try run cmp AUTOLOAD
|
||||
rc error_count text lines error_list put
|
||||
cd tsh_tempdir
|
||||
|
||||
|
@ -470,6 +470,19 @@ sub fail {
|
|||
exit( $rc || 74 );
|
||||
}
|
||||
|
||||
sub cmp {
|
||||
# compare input string with text()
|
||||
my $text = text();
|
||||
my $in = shift;
|
||||
|
||||
if ($text eq $in) {
|
||||
ok();
|
||||
} else {
|
||||
fail('cmp failed', '');
|
||||
dbg(4, "\n\ntext = <<<$text>>>, in = <<<$in>>>\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub expect {
|
||||
my ( $patt, $msg ) = @_;
|
||||
$msg =~ s/^\s+// if $msg;
|
||||
|
|
Loading…
Reference in a new issue