# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1421222274 -3600 # Node ID b238038dbf450d1994fad023a0199d9341e97e97 # Parent 179ec13d90017cb4291d5cbecaa14a5c9d992396# Parent 8428f9dae1412e802b7d9fd51aa7d7d414a8f943 [merged] from branch deb diff -r 8428f9dae141 -r b238038dbf45 .hgsigs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgsigs Wed Jan 14 08:57:54 2015 +0100 @@ -0,0 +1,1 @@ +3de74dbafc890fe0e920521777be15d262b1d8cc 0 iQEcBAABCgAGBQJUtbxLAAoJEJG05d4bZCmnUCMH/RVMWL//Q+23MOeSd1Y1v7t8BzZhm+nnaM5c7IZPFZlTocvnxyUNAqS/y4rZQDfpMZr9XFQLw8k9rgt17DHJ5/rXUzbJGTrsFMTpYxOop9HFvY6iwftzFSR35ShVDB8Y916D/LVO/6thoIcnob56ha+OYTpLen+vdg8XgcbAhAtwGGNSlETKI6VXFRVydaItnqV2odfWhDHUUQbcOe5pQPOHltB9NBxGHu4s7mHSR55TpwBm0iKYs0SdREJkcP705XyrpmVYb82qyCtjEyyEucaSt0hMjXiMdkk3VK0MKgUiDM9lQvQ5ZiSfprERidOIVBH41M3TaiqrXSa7y3wpLwo= diff -r 8428f9dae141 -r b238038dbf45 t/10-dnsvi.t --- a/t/10-dnsvi.t Mon Dec 08 10:24:26 2014 +0100 +++ b/t/10-dnsvi.t Wed Jan 14 08:57:54 2015 +0100 @@ -19,8 +19,8 @@ return <$x>; } -# the results must match the t/samples/? files -my %result = ( +# the expect must match the t/samples/? files +my %expect = ( axfr => { RRSETS => 64, SOA => 1, @@ -57,25 +57,50 @@ AAAA => 0, MX => 2, }, + d => { + RRSETS => 15, + SOA => 1, + NS => 2, + A => [sort qw/ + abc.de.km21.de. + foo.km21.de. + tte.km21.de. + tte.km21.de. + bar.km21.de. + /], + TXT => 5, + AAAA => 0, + MX => 2, + }, ); # uniq list of rrtypes we want to test my @sets = do { my %h; - @h{ map { keys %{$_} } values %result } = (); + @h{ map { keys %{$_} } values %expect } = (); grep { $_ ne 'RRSETS' } sort keys %h; }; -foreach my $sample (sort keys %result) { +#foreach my $sample (sort keys %expect) { +foreach my $sample ('d') { my $file = "t/samples/$sample"; subtest "sample $file" => sub { - my %result = %{ $result{$sample} }; + my %expect = %{ $expect{$sample} }; my @zone = parse(slurp $file); - is @zone, $result{RRSETS} => "$sample: $result{RRSETS} RRSETS"; +# use Data::Dumper; +# diag Dumper \@zone; + is @zone, $expect{RRSETS} => "$sample: $expect{RRSETS} RRSETS"; foreach my $type (@sets) { +# diag '----------->' . $type; + if (ref $expect{$type}) { + my @entries = sort map { $_->{label} } grep { $_->{rrtype} eq $type } map { $_->{rrset} } @zone; + is_deeply \@entries, $expect{$type} => 'list of labels'; + } + else { is grep({ $_->{rrset}{rrtype} eq $type } @zone), - $result{$type} => "$sample: $result{$type} $type"; + $expect{$type} => "number of $type rrsets\n"; + } } my ($added, $deleted) = delta(\@zone, \@zone); diff -r 8428f9dae141 -r b238038dbf45 t/samples/d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/t/samples/d Wed Jan 14 08:57:54 2015 +0100 @@ -0,0 +1,19 @@ +$ORIGIN km21.de. +$TTL 1d +; do NOT EDIT the SOA records SERIAL number! +@ SOA pu.schlittermann.de. hostmaster.schlittermann.de. 1397766411 86400 7200 604800 300 + NS hh.schlittermann.de. + NS pu.schlittermann.de. + TXT "invoice: self" + TXT "utf8: km21.de" + TXT "start: 1396981300 2014-04-08T20:21:40" +tte A 85.214.245.1 + IN A 1.1.1.1 + TXT "tte" +; only one space + IN TXT "tte2" + IN MX 10 mexico. + IN MX 20 mx20. +foo A 1.1.1.2 +bar.km21.de. A 1.1.1.3 +abc.de A 1.2.3.4