summaryrefslogtreecommitdiff
path: root/tests/WgetFeature.pm
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:13 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:13 +0900
commit61fb427c104d6f2334aaee9c7d90d8287d521b17 (patch)
treee4caa30fa69cb51705f22392cab8cf9c04dffb94 /tests/WgetFeature.pm
parent1478f6ab011981e9a986c0c30da680635d3e77bf (diff)
downloadwget-61fb427c104d6f2334aaee9c7d90d8287d521b17.tar.gz
wget-61fb427c104d6f2334aaee9c7d90d8287d521b17.tar.bz2
wget-61fb427c104d6f2334aaee9c7d90d8287d521b17.zip
Imported Upstream version 1.16.1upstream/1.16.1
Diffstat (limited to 'tests/WgetFeature.pm')
-rw-r--r--tests/WgetFeature.pm41
1 files changed, 28 insertions, 13 deletions
diff --git a/tests/WgetFeature.pm b/tests/WgetFeature.pm
index f58b998..28e0c11 100644
--- a/tests/WgetFeature.pm
+++ b/tests/WgetFeature.pm
@@ -3,26 +3,41 @@ package WgetFeature;
use strict;
use warnings;
-use WgetTest;
+our $VERSION = 0.01;
-our %skip_messages;
-require 'WgetFeature.cfg';
+use Carp;
+use English qw(-no_match_vars);
+use FindBin;
+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 =~ /^([\+\-]\S+(?:\s+[\+\-]\S+)+)/m;
- my %have_features = map {
- my $feature = $_;
- $feature =~ s/^.//;
- ($feature, /^\+/ ? 1 : 0);
- } split /\s+/, $list;
-
- unless ($have_features{$feature}) {
- print $skip_messages{$feature}, "\n";
- exit 2; # skip
+ 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
}
}