From c265d421607a41140f69d81395631b40820a2dd7 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 15 May 2020 19:11:48 +0200 Subject: [PATCH] tests: archive info: avoid assembling arrays to just de-assemble them directly Signed-off-by: Thomas Lamprecht --- test/archive_info_test.pm | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/test/archive_info_test.pm b/test/archive_info_test.pm index ce873b3..c0343af 100644 --- a/test/archive_info_test.pm +++ b/test/archive_info_test.pm @@ -75,20 +75,16 @@ for my $virt (sort keys %$bkp_suffix) { my ($format, $decomp) = $bkp_suffix->{$virt}->@*; for my $suffix (sort keys %$decomp) { - my @arr = ( - { - description => "Backup archive, $virt, $format.$suffix", - archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix", - expected => { - 'type' => "$virt", - 'format' => "$format", - 'decompressor' => $decomp->{$suffix}, - 'compression' => "$suffix", - }, + push @$tests, { + description => "Backup archive, $virt, $format.$suffix", + archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$format.$suffix", + expected => { + 'type' => "$virt", + 'format' => "$format", + 'decompressor' => $decomp->{$suffix}, + 'compression' => "$suffix", }, - ); - - push @$tests, @arr; + }; } } @@ -103,16 +99,12 @@ my $non_bkp_suffix = { # create tests for failed matches for my $virt (sort keys %$non_bkp_suffix) { my $suffix = $non_bkp_suffix->{$virt}; - foreach my $s (@$suffix) { - my @arr = ( - { - description => "Failed match: Backup archive, $virt, $s", - archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$s", - expected => "ERROR: couldn't determine format and compression type\n", - }, - ); - - push @$tests, @arr; + for my $s (@$suffix) { + push @$tests, { + description => "Failed match: Backup archive, $virt, $s", + archive => "backup/vzdump-$virt-$vmid-2020_03_30-21_12_40.$s", + expected => "ERROR: couldn't determine format and compression type\n", + }; } } -- 2.39.5