X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=t%2F3_conf_00_base.t;h=bd6e31c8b7cb91b25b0eb317b4297ed80ad1c059;hb=f30b8252fcf71659a2fd3b5895e009ff8e39299d;hp=31591c00d33cf26c1fb6a42b916b58ced1bb554c;hpb=85070b46d0a93ddbeef07341421adb8389a55418;p=chaz%2Fp5-CGI-Ex diff --git a/t/3_conf_00_base.t b/t/3_conf_00_base.t index 31591c0..bd6e31c 100644 --- a/t/3_conf_00_base.t +++ b/t/3_conf_00_base.t @@ -1,69 +1,17 @@ # -*- Mode: Perl; -*- -use Test; +=head1 NAME -BEGIN {plan tests => 24}; +3_conf_00_base.t - Test for the basic functionality of CGI::Ex::Conf -use CGI::Ex::Conf; -ok(1); +=cut -my $dir = $0; -$dir =~ tr|\\|/|; # should probably use File::Spec -$dir =~ s|/[^/]+$||; -$dir = '.' if ! length $dir; -$dir .= '/samples'; -my $obj = CGI::Ex::Conf->new({ - paths => ["$dir/conf_path_1", "$dir/conf_path_3"], -}); +use strict; +use Test::More tests => 2; -### most test for the reading of files -### are actually performed in the validation tests +use_ok('CGI::Ex::Conf'); +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