summaryrefslogtreecommitdiff
path: root/scripts/t/Dpkg_Checksums.t
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-08-25 01:30:06 +0200
committerGuillem Jover <guillem@debian.org>2018-08-30 03:14:09 +0200
commite596defa91399a04792c7b37a6eb74a67cd10661 (patch)
tree957f7bbbdde7b89ea33a2b334572568d4849f94f /scripts/t/Dpkg_Checksums.t
parentb051c0d58e99a76c3be616f374307d78503da5c5 (diff)
downloaddpkg-e596defa91399a04792c7b37a6eb74a67cd10661.tar.gz
scripts/t: Improve coverage of unit tests
Diffstat (limited to 'scripts/t/Dpkg_Checksums.t')
-rw-r--r--scripts/t/Dpkg_Checksums.t30
1 files changed, 29 insertions, 1 deletions
diff --git a/scripts/t/Dpkg_Checksums.t b/scripts/t/Dpkg_Checksums.t
index 82a45fe31..33e2587e1 100644
--- a/scripts/t/Dpkg_Checksums.t
+++ b/scripts/t/Dpkg_Checksums.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 44;
+use Test::More tests => 59;
use Test::Dpkg qw(:paths);
BEGIN {
@@ -120,4 +120,32 @@ foreach my $alg (keys %str_checksum) {
test_checksums($ck);
+# Check remove_file()
+
+ok($ck->has_file('data-2'), 'To be removed file is present');
+$ck->remove_file('data-2');
+ok(!$ck->has_file('data-2'), 'Remove file is not present');
+
+# Check add_from_control()
+my $ctrl;
+foreach my $f (@data) {
+ next if $f->{file} ne 'data-2';
+ foreach my $alg (keys %{$f->{sums}}) {
+ $ctrl->{"Checksums-$alg"} = "\n$f->{sums}->{$alg} $f->{size} $f->{file}";
+ }
+}
+$ck->add_from_control($ctrl);
+
+test_checksums($ck);
+
+# Check export_to_control()
+
+my $ctrl_export = {};
+$ck->export_to_control($ctrl_export);
+
+foreach my $alg (keys %str_checksum) {
+ is($ctrl_export->{"Checksums-$alg"}, $str_checksum{$alg},
+ "Export checksum $alg to a control object");
+}
+
1;