mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
fixed rt.cpan.org#113671: recognize BOM at start of a utf8 file
fixed rt.cpan.org#112857: Same Line Closing Block Breaks Parser git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@110 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
17
t/run.t
17
t/run.t
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
use Data::Dumper;
|
||||
use Test::More tests => 73;
|
||||
use Test::More tests => 75;
|
||||
#use Test::More qw(no_plan);
|
||||
|
||||
# ahem, we deliver the test code with a local copy of
|
||||
@@ -18,7 +18,7 @@ use lib qw(t);
|
||||
use Tie::IxHash;
|
||||
my @WARNINGS_FOUND;
|
||||
BEGIN {
|
||||
$SIG{__WARN__} = sub { diag( "WARN: ", join( '', @_ ) ); push @WARNINGS_FOUND, @_ };
|
||||
$SIG{__WARN__} = sub { diag( "WARN: ", join( '', @_ ) ); push @WARNINGS_FOUND, @_ };
|
||||
}
|
||||
|
||||
### 1
|
||||
@@ -761,3 +761,16 @@ eval {
|
||||
$cfg56->save_file("t/56.out", { "new\nline" => 9, "brack<t" => 8 });
|
||||
};
|
||||
ok($@, "catch special chars in keys");
|
||||
|
||||
|
||||
# UTF8[BOM] tests
|
||||
my $cfg57 = "t/utf8_bom/foo.cfg";
|
||||
my $expected57 = {foo => {"\x{e9}" => "\x{e8}", bar => {"\x{f4}" => "\x{ee}"}}};
|
||||
|
||||
for my $bool (0, 1) {
|
||||
my $conf = Config::General->new(-ConfigFile => $cfg57,
|
||||
-IncludeRelative => 1,
|
||||
-UTF8 => $bool);
|
||||
my %hash = $conf->getall;
|
||||
is_deeply \%hash, $expected57, "-UTF8 => $bool";
|
||||
}
|
||||
|
||||
3
t/utf8_bom/bar.cfg
Normal file
3
t/utf8_bom/bar.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
<bar>
|
||||
ô = î
|
||||
</bar>
|
||||
4
t/utf8_bom/foo.cfg
Normal file
4
t/utf8_bom/foo.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
<foo>
|
||||
é = è
|
||||
<<include bar.cfg>>
|
||||
</foo>
|
||||
Reference in New Issue
Block a user