diff -r ac04894f45c1 -r fc2156761c29 t/00-config.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/t/00-config.t Fri Jan 14 22:12:24 2011 +0100 @@ -0,0 +1,38 @@ +#! /usr/bin/perl + +use strict; +use warnings; +use Test::More; +use Pod::Coverage; +use File::Temp; + +BEGIN { + use_ok "DNStools::Config", "get_config"; +} + +can_ok("DNStools::Config" => "get_config"); + +# should die if there is no config +eval { get_config() }; +ok($@, "dies on missing file names"); + +eval { get_config("xxx|xxx", "yyy|yyy") }; +ok($@, "dies on missing config"); + +# prepare some simple sample config +my $tmp = File::Temp->new(); +print {$tmp} <<__EOF; +# comment +abc = xyz +other = value with space +__EOF +close($tmp); + +my %cf = get_config($tmp->filename); +ok(%cf, "got config"); + +is($cf{abc} => "xyz", "simple value"); +is($cf{other} => "valuewithspace", "spaced value"); + + +done_testing();