2.03 - fixed bug in the _parse() routine (better: design flaw).

after the last patch for allowing whitespaces in
	   option names, it had a problem with here-docs which
	   contained equal signs. option/value splitting resulted
	   in weird output.

	 - as a side effect of the bug fix below it is now
	   possible to use equal signs inside quoted values, which
	   will then be ignored, thus not used for splitting
	   the line into an option/value assignment.

	 - added a new test, which tests for all possible notations
	   of option/value lines.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@29 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
Thomas von Dein
2009-10-10 16:22:10 +00:00
parent 8a7ed54c44
commit f5ac2b6b75
6 changed files with 75 additions and 16 deletions

16
t/cfg.19 Normal file
View File

@@ -0,0 +1,16 @@
#
# these options must all in
# msg[\d] keys.
#
msg1 = "Das ist ein Test"
msg2 = "Das = ein Test"
msg3 "Das ist ein Test"
msg4 "Das = ein Test"
msg6 = <<EOF
Das = ein Test
EOF
msg7 <<EOF
Das = ein Test
msg7

View File

@@ -1,7 +1,14 @@
/*
# Here-document test
message <<EOF
message = <<EOF
yes. we are not here. you
can reach us somewhere in
outerspace.
# and this line will remain inside the here-doc!
EOF
*/
header = <<EOF
<table border="0">
</table>
EOF

20
t/run.t
View File

@@ -6,7 +6,7 @@
#
# Under normal circumstances every test should succeed.
BEGIN { $| = 1; print "1..18\n";}
BEGIN { $| = 1; print "1..19\n";}
use lib "blib/lib";
use Config::General;
use Data::Dumper;
@@ -170,7 +170,23 @@ else {
# testing various otion/value assignemnt notations
my $conf19 = new Config::General(-file => "t/cfg.19");
my %h19 = $conf19->getall();
my $works = 1;
foreach my $key (keys %h19) {
if ($key =~ /\s/) {
$works = 0;
}
}
if ($works) {
print "ok\n";
print STDERR " .. ok # Testing various otion/value assignemnt notations\n";
}
else {
print "19 not ok\n";
print STDERR "19 not ok\n";
}