]> git.proxmox.com Git - pve-storage.git/commitdiff
tests: archive info: code cleanup
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 16:57:37 +0000 (18:57 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 17:01:39 +0000 (19:01 +0200)
We could also do a hash array slice, like:
> my ($archive, $expected, $description) = $tt->@{'archive', 'expected', 'description'};

But as none are optional lets just access values directly..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
test/archive_info_test.pm

index 7db02d1d52cc56c391e3bbb8ab947fb93920dd6f..60d606eb38011aa17031ef6535da6246f29128a8 100644 (file)
@@ -119,16 +119,12 @@ foreach my $virt (keys %$non_bkp_suffix) {
 
 plan tests => scalar @$tests;
 
-# run through tests array
-foreach my $tt (@$tests) {
-    my $description = $tt->{description};
-    my $archive = $tt->{archive};
-    my $expected = $tt->{expected};
-    my $got;
-    eval { $got = PVE::Storage::archive_info($archive) };
+for my $tt (@$tests) {
+
+    my $got = eval { PVE::Storage::archive_info($tt->{archive}) };
     $got = $@ if $@;
 
-    is_deeply($got, $expected, $description) || diag(explain($got));
+    is_deeply($got, $tt->{expected}, $tt->{description}) || diag(explain($got));
 }
 
 done_testing();