Commit 559b4108 authored by Christophe Maudoux's avatar Christophe Maudoux

Fix unit test for Debian Buster

parent e1565191
......@@ -17,10 +17,8 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
my $h;
ok(
$h = new Lemonldap::NG::Common::Conf(
{
type => 'File',
ok( $h = new Lemonldap::NG::Common::Conf(
{ type => 'File',
dirName => "t/",
}
),
......@@ -40,25 +38,27 @@ my @test = (
{ cfgNum => 1, test => 'éà' }
);
for ( my $i = 0 ; $i < @test ; $i++ ) {
for ( my $i = 0; $i < @test; $i++ ) {
ok( $h->store( $test[$i] ) == 1, "Test $i is stored" )
or print STDERR "$Lemonldap::NG::Common::Conf::msg $!";
or print STDERR "$Lemonldap::NG::Common::Conf::msg $!";
$count++;
if ( -x '/usr/bin/file' ) {
eval {
open F, 'file t/lmConf-1.json |';
$_ = join( '', <F> );
close F;
ok( /(ascii|utf-?8|json\s?data)/si, "File is $1 encoded" );
print STDERR "Result: $_\n";
## Debian Buster 'file' command returns JSON DATA
ok( /(ascii|utf-?8|json\sdata)/si, "File is $1 encoded" )
or print STDERR "Result: $_\n";
$count++;
};
}
my $cfg;
ok( $cfg = $h->load(1), "Test $i can be read" )
or print STDERR $Lemonldap::NG::Common::Conf::msg;
or print STDERR $Lemonldap::NG::Common::Conf::msg;
ok( $cfg->{test} eq $test[$i]->{test}, "Test $i is restored" )
or print STDERR "Expect $cfg->{test} eq $test[$i]->{test}\n";
or print STDERR "Expect $cfg->{test} eq $test[$i]->{test}\n";
$count += 2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment