t/00-config.t
branchhs12
changeset 86 dc8741bbad33
parent 85 c47953192c5c
child 103 0c9f37c94f0c
equal deleted inserted replaced
85:c47953192c5c 86:dc8741bbad33
     5 use Test::More;
     5 use Test::More;
     6 use Pod::Coverage;
     6 use Pod::Coverage;
     7 use File::Temp;
     7 use File::Temp;
     8 
     8 
     9 BEGIN {
     9 BEGIN {
    10     use_ok "DNStools::Config", "get_config";
    10     use_ok "DNStools::Config" => qw(get_config);
    11 }
    11 }
    12 
    12 
    13 can_ok("DNStools::Config" => "get_config");
    13 can_ok("DNStools::Config" => "get_config");
    14 
    14 
    15 eval { get_config("xxx|xxx", "yyy|yyy") };
    15 eval { get_config("xxx|xxx", "yyy|yyy") };
    35 
    35 
    36 # it should find the file specified in $ENV{DNSTOOLS_CONF}
    36 # it should find the file specified in $ENV{DNSTOOLS_CONF}
    37 $ENV{DNSTOOLS_CONF} = $tmp->filename;
    37 $ENV{DNSTOOLS_CONF} = $tmp->filename;
    38 %cf = ();
    38 %cf = ();
    39 %cf = get_config("xxx|xxx", $tmp->filename);
    39 %cf = get_config("xxx|xxx", $tmp->filename);
    40 ok(%cf, "got config from env");
    40 ok(%cf, "got config from \$DNSTOOLS_CONF");
    41 is($cf{abc} => "xyz", "simple value");
    41 is($cf{abc} => "xyz", "simple value");
    42 is($cf{other} => "valuewithspace", "spaced value");
    42 is($cf{other} => "valuewithspace", "spaced value");
    43 
    43 
    44 
    44 
    45 done_testing();
    45 done_testing();