X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-CGI-Ex;a=blobdiff_plain;f=t%2F3_conf_00_base.t;fp=t%2F3_conf_00_base.t;h=bd6e31c8b7cb91b25b0eb317b4297ed80ad1c059;hp=cae8b75058aed079b4d27e6ee422c06266bf6268;hb=f30b8252fcf71659a2fd3b5895e009ff8e39299d;hpb=8a1796477c5a835d8c124cfa8504909dc786d93b diff --git a/t/3_conf_00_base.t b/t/3_conf_00_base.t index cae8b75..bd6e31c 100644 --- a/t/3_conf_00_base.t +++ b/t/3_conf_00_base.t @@ -7,67 +7,11 @@ =cut use strict; -use Test::More tests => 24; +use Test::More tests => 2; use_ok('CGI::Ex::Conf'); -my $dir = __FILE__; -$dir =~ tr|\\|/|; # should probably use File::Spec -$dir =~ s|[^/]+$|../samples| || die "Couldn't determine dir"; -$dir =~ s|^t/|./t/|; # to satisfy conf - -my $obj = CGI::Ex::Conf->new({ - paths => ["$dir/conf_path_1", "$dir/conf_path_3"], -}); - -### most test for the reading of files -### are actually performed in the validation tests - +my $obj = CGI::Ex::Conf->new; ok($obj); -my $hash = $obj->read('apples.pl'); -ok($hash); -ok($hash->{quantity}); - -$hash = $obj->read('apples.pl'); -ok($hash); -ok($hash->{quantity}); - - -local $CGI::Ex::Conf::DIRECTIVE = 'FIRST'; -$hash = $obj->read('apples.pl'); -ok($hash); -ok($hash->{quantity} == 20); -ok($hash->{foo} eq 'file1'); - -local $CGI::Ex::Conf::DIRECTIVE = 'LAST'; -$hash = $obj->read('apples.pl'); -ok($hash); -ok($hash->{quantity} == 30); -ok($hash->{foo} eq 'file2'); - -$hash = $obj->read('apples.pl', {directive => 'MERGE'}); -ok($hash); -ok($hash->{quantity} == 30); -ok($hash->{foo} eq 'file1'); # has immutable value - - -local $obj->{directive} = 'FIRST'; -$hash = $obj->read('oranges.pl'); -ok($hash); -ok($hash->{quantity} == 20); -ok($hash->{foo} eq 'file1'); - -local $obj->{directive} = 'LAST'; -$hash = $obj->read('oranges.pl'); -ok($hash); -ok($hash->{quantity} == 30); -ok($hash->{foo} eq 'file2'); - -local $obj->{directive} = 'MERGE'; -$hash = $obj->read('oranges.pl'); -ok($hash); -ok($hash->{quantity} == 20); # has immutable key so all values are immutable -ok($hash->{foo} eq 'file1'); # has immutable key so all values are immutable - - +### TODO - re-enable more fileside tests