Commit 559b4108 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛
Browse files

Fix unit test for Debian Buster

parent e1565191
...@@ -17,10 +17,8 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') } ...@@ -17,10 +17,8 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
my $h; my $h;
ok( ok( $h = new Lemonldap::NG::Common::Conf(
$h = new Lemonldap::NG::Common::Conf( { type => 'File',
{
type => 'File',
dirName => "t/", dirName => "t/",
} }
), ),
...@@ -40,25 +38,27 @@ my @test = ( ...@@ -40,25 +38,27 @@ my @test = (
{ cfgNum => 1, 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" ) 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++; $count++;
if ( -x '/usr/bin/file' ) { if ( -x '/usr/bin/file' ) {
eval { eval {
open F, 'file t/lmConf-1.json |'; open F, 'file t/lmConf-1.json |';
$_ = join( '', <F> ); $_ = join( '', <F> );
close 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++; $count++;
}; };
} }
my $cfg; my $cfg;
ok( $cfg = $h->load(1), "Test $i can be read" ) 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" ) 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; $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