i 1.24: - AllowMultiOptions printed out the value and not the

option itself, if more than one of this particular
           option occured.
         - added -UseApacheInclude feature, contributed by
           Thomas Klausner <domm@zsi.at>
         - fixed bug with multiple options stuff, which did not
           work with blocks or named blocks. Pointed out by
           Thomas Klausner <domm@zsi.at>, who meant it being
           feature request, but in fact it was a bug (IMHO).
	 - Config::General does now contain also it's OO-sister
	   Config::General::Extended, which is from now on
 	   no more available as an extra module, because it
	   lived a shadowy existence.
	 - finally(!) created a Changelog file (this one, yes).


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@12 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
Thomas von Dein
2009-10-10 16:11:25 +00:00
parent fc54974d01
commit 95195c0038
7 changed files with 860 additions and 60 deletions

83
t/run.t
View File

@@ -1,15 +1,18 @@
#
# testscript for Conf.pm by Thomas Linden
# testscript for Config::General Classes by Thomas Linden
#
# needs to be invoked using the command "make test" from
# the Conf.pm source directory.
# Under normal circumstances every test should run.
# the Config::General source directory.
#
# Under normal circumstances every test should succeed.
BEGIN { $| = 1; print "1..8\n";}
BEGIN { $| = 1; print "1..15\n";}
use lib "blib/lib";
use Config::General;
use Config::General::Extended;
use Data::Dumper;
print "ok\n";
print STDERR "\n1 .. ok # loading Config::General\n";
print STDERR "\n1 .. ok # loading Config::General and Config::General::Extended\n";
foreach (2..7) {
&p("t/cfg." . $_, $_);
@@ -37,6 +40,76 @@ else {
}
############## Extended Tests #################
$conf = new Config::General::Extended("t/test.rc");
print "ok\n";
print STDERR "9 .. ok # Creating a new object from config file\n";
# now test the new notation of new()
my $conf2 = new Config::General::Extended(
-file => "t/test.rc",
-AllowMultiOptions => "yes"
);
print "ok\n";
print STDERR "10 .. ok # Creating a new object using the hash parameter way\n";
my $domain = $conf->obj("domain");
print "ok\n";
print STDERR "11 .. ok # Creating a new object from a block\n";
my $addr = $domain->obj("bar.de");
print "ok\n";
print STDERR "12 .. ok # Creating a new object from a sub block\n";
my @keys = $conf->keys("domain");
print "ok\n";
print STDERR "13 .. ok # Getting values from the object\n";
# test various OO methods
if ($conf->is_hash("domain")) {
my $domains = $conf->obj("domain");
foreach my $domain ($conf->keys("domain")) {
my $domain_obj = $domains->obj($domain);
foreach my $address ($domains->keys($domain)) {
my $blah = $domain_obj->value($address);
}
}
}
print "ok\n";
print STDERR "14 .. ok # Using keys() and values() \n";
# test AUTOLOAD methods
my $conf3 = new Config::General::Extended( { name => "Moser", prename => "Hannes"}
);
my $n = $conf3->name;
my $p = $conf3->prename;
$conf3->name("Meier");
$conf3->prename("Max");
$conf3->save("t/test.cfg");
print "ok\n";
print STDERR "15 .. ok # Using AUTOLOAD methods\n";
sub p {
my($cfg, $t) = @_;
open T, "<$cfg";