summaryrefslogtreecommitdiffstats
path: root/tests/WgetFeature.pm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:04:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:04:52 +0000
commit5e03c718f4e7ff13cb6834eda737c269ebed02ad (patch)
treebfad3f5be123f000fdb03e26400050dece33d72f /tests/WgetFeature.pm
parentInitial commit. (diff)
downloadwget-5e03c718f4e7ff13cb6834eda737c269ebed02ad.tar.xz
wget-5e03c718f4e7ff13cb6834eda737c269ebed02ad.zip
Adding upstream version 1.21.3.upstream/1.21.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/WgetFeature.pm41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/WgetFeature.pm b/tests/WgetFeature.pm
new file mode 100644
index 0000000..0d59573
--- /dev/null
+++ b/tests/WgetFeature.pm
@@ -0,0 +1,41 @@
+package WgetFeature;
+
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+use English qw(-no_match_vars);
+use WgetTests;
+
+sub import
+{
+ my ($class, @required_feature) = @_;
+
+ # create a list of available features from 'wget --version' output
+ 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;
+ }
+
+ foreach (@required_feature)
+ {
+ if (!$have_features{$_})
+ {
+ print "Skipped test: Wget misses feature '$_'\n";
+ print "Features available from 'wget --version' output:\n";
+ foreach (keys %have_features)
+ {
+ print " $_=$have_features{$_}\n";
+ }
+ exit 77; # skip
+ }
+ }
+}
+
+1;