summaryrefslogtreecommitdiffstats
path: root/t/scripts/version.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
commit75808db17caf8b960b351e3408e74142f4c85aac (patch)
tree7989e9c09a4240248bf4658a22208a0a52d991c4 /t/scripts/version.t
parentInitial commit. (diff)
downloadlintian-upstream.tar.xz
lintian-upstream.zip
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/scripts/version.t')
-rwxr-xr-xt/scripts/version.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/scripts/version.t b/t/scripts/version.t
new file mode 100755
index 0000000..6e1f23d
--- /dev/null
+++ b/t/scripts/version.t
@@ -0,0 +1,38 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+use Const::Fast;
+use Test::More tests => 13;
+
+use Lintian::Relation::Version qw(:all);
+
+const my $EQUAL => q{=};
+
+ok(versions_equal('1.0', '1.0'), 'Basic equality');
+ok(versions_equal('1.0', '1.00'), '0 == 00');
+ok(versions_gte('1.1', '1.0'), 'Basic >=');
+ok(!versions_lte('1.1', '1.0'), 'Basic <=');
+ok(versions_gt('1.1', '1.0'), 'Basic >');
+ok(!versions_lt('1.1', '1.1'), 'Basic <');
+
+ok(versions_compare('1.1', '<=', '1.1'), 'compare() <=');
+ok(versions_compare('1.2', '>=', '1.1'), 'compare() >=');
+ok(versions_compare('0:1-1', $EQUAL, '1-1'), 'compare() = with epoch 0');
+ok(versions_compare('2.3~', '<<', '2.3'), 'compare() << with tilde');
+ok(!versions_compare('1:1.0', '>>', '1:1.1'), 'compare() >> with equal epoch');
+ok(
+ !versions_compare('1:1.1', '>>', '2:1.0'),
+ 'compare() >> with different epochs'
+);
+ok(
+ versions_compare('1:1.1', '<<', '2:1.1'),
+ 'compare() << with different epochs'
+);
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et