1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00
wget/tests/WgetFeature.pm

45 lines
942 B
Perl
Raw Normal View History

package WgetFeature;
use strict;
use warnings;
our $VERSION = 0.01;
use Carp;
use English qw(-no_match_vars);
use FindBin;
2014-09-24 10:40:03 -04:00
use WgetTests;
our %SKIP_MESSAGES;
{
my $cfgfile = "$FindBin::Bin/WgetFeature.cfg";
open my $fh, '<', $cfgfile
or croak "Cannot open '$cfgfile': $ERRNO";
my @lines = <$fh>;
close $fh or carp "Cannot close '$cfgfile': $ERRNO";
my $evalstr = join q{}, @lines;
eval { $evalstr } or carp "Cannot eval '$cfgfile': $ERRNO";
}
sub import
{
my ($class, $feature) = @_;
my $output = `$WgetTest::WGETPATH --version`;
my ($list) = $output =~ m/^([+-]\S+(?:\s+[+-]\S+)+)/msx;
my %have_features;
for my $f (split m/\s+/msx, $list)
{
my $feat = $f;
$feat =~ s/^.//msx;
$have_features{$feat} = $f =~ m/^[+]/msx ? 1 : 0;
}
if (!$have_features{$feature})
{
print "$SKIP_MESSAGES{$feature}\n";
exit 77; # skip
}
}
1;