mirror of
https://github.com/stephenenelson/convert-binhex.git
synced 2024-11-22 02:30:55 +00:00
35 lines
704 B
Perl
35 lines
704 B
Perl
package Checker;
|
|
|
|
use Exporter 'import';
|
|
|
|
@EXPORT = qw($CHECK okay_if note check filter_warnings);
|
|
|
|
$Checker::OUTPUT = 1;
|
|
$Checker::CHECK = 0;
|
|
|
|
# Only lets through warnings that originate outside our toolkit:
|
|
sub filter_warnings {
|
|
$SIG{'__WARN__'} = sub {
|
|
print STDERR $_[0] if ($_[0] !~ /^MIME:/);
|
|
};
|
|
}
|
|
|
|
sub okay_if {
|
|
print( ($_[0] ? "ok\n" : "not ok\n"))
|
|
}
|
|
|
|
sub note {
|
|
print STDOUT " ## ", @_, "\n" if $OUTPUT;
|
|
}
|
|
|
|
sub check {
|
|
++$CHECK;
|
|
my ($ok, $note) = @_;
|
|
$note = ($note ? ": $note" : '');
|
|
my $stat = ($ok ? 'OK ' : 'ERR');
|
|
printf STDOUT " Test %2d$note\n", $CHECK if $OUTPUT;
|
|
print(($ok ? "ok $CHECK\n" : "not ok $CHECK\n"));
|
|
}
|
|
1;
|
|
|