t/10-minimal.t
changeset 15 bb7b3ae76cc8
parent 14 8da9e81acf82
child 17 07827090c4fc
--- a/t/10-minimal.t	Tue Jan 06 21:42:41 2015 +0100
+++ b/t/10-minimal.t	Tue Jan 06 22:40:18 2015 +0100
@@ -12,10 +12,12 @@
 # kommentar
     a # more comment
     b
-    c
+    c ns1 ns2 # comment
+    d
 __
 $tmp->flush;
 
+
 sub dig_serial { (split " ", `dig +short SOA @_`)[2] }
 
 sub dig_ns {
@@ -30,6 +32,15 @@
 subtest 'tools' => sub {
     is_deeply [sort +uniq(qw(a b a c))], [qw(a b c)] => 'uniq helper';
 
+    # get_domains should read a list of names, either from a file
+    # or from the arguments, or from a combination of both
+    is_deeply [get_domains(qw(a b c))], [qw(a b c)] => 'domains from list';
+    is_deeply [get_domains("$tmp")],    [qw(a b c d)] => 'domains from file';
+    is_deeply [get_domains('a', "$tmp", 'z')],
+      [qw(a a b c d z)] => 'domains from args and file';
+
+    is_deeply {read_override("$tmp")}, { c => ['ns1', 'ns2'] }, 'override file';
+
     my %google = ( nameservers => [qw/8.8.8.8 8.8.4.4/]);
     my %level3 = ( nameservers => [qw/209.244.0.3 209.244.0.4/]);
 
@@ -58,12 +69,12 @@
 };
 
 
-# get_domains should read a list of names, either from a file
-# or from the arguments, or from a combination of both
-is_deeply [get_domains(qw(a b c))], [qw(a b c)] => 'domains from list';
-is_deeply [get_domains("$tmp")],    [qw(a b c)] => 'domains from file';
-is_deeply [get_domains('a', "$tmp", 'z')],
-  [qw(a a b c z)] => 'domains from args and file';
+my %override = (
+    'example.com' => [qw(ns1.foobar.de ns2.foobar.com)],
+);
+
+is_deeply [ns('example.com', nameservers => [qw/127.0.0.1/], override => \%override)],
+    $override{'example.com'} => 'override';
 
 for (qw(heise.de schlittermann.de google.com debian.org example.org)) {