Permalink
Browse files

tests: compare files in "text mode"

Use File::Compare's compare_text() function to compare generated files
with the expected tempaltes.
This should fix the tests on Windows too.
  • Loading branch information...
1 parent bcffdbd commit 4f2965f3ecd92f2ad39c1194c48593d398efe83f @marschap marschap committed Nov 30, 2012
Showing with 8 additions and 7 deletions.
  1. +4 −3 t/00ldif-entry.t
  2. +2 −2 t/05dsml.t
  3. +2 −2 t/common.pl
View
7 t/00ldif-entry.t
@@ -5,6 +5,7 @@ BEGIN {
}
use Test::More tests => 16;
+use File::Compare qw(compare_text);
use Net::LDAP::LDIF;
@@ -51,9 +52,9 @@ ok($ldif->version == 1, "version == 1");
Net::LDAP::LDIF->new($outfile1,"w")->write(@entry);
Net::LDAP::LDIF->new($outfile2,"w", version => 1)->write(@entry);
-ok(!compare($cmpfile1,$outfile1), $cmpfile1);
+ok(!compare_text($cmpfile1,$outfile1), $cmpfile1);
-ok(!compare($cmpfile2,$outfile2), $cmpfile2);
+ok(!compare_text($cmpfile2,$outfile2), $cmpfile2);
is($e->ldif, "\n$entry0_ldif", "ldif method");
@@ -156,7 +157,7 @@ $ldif = Net::LDAP::LDIF->new($outfile,"w");
$ldif->write($e);
$ldif->write_cmd($e);
$ldif->done;
-ok(!compare($cmpfile,$outfile), $cmpfile);
+ok(!compare_text($cmpfile,$outfile), $cmpfile);
$e->add('name' => 'Graham Barr');
$e->add('name;en-us' => 'Bob');
View
4 t/05dsml.t
@@ -1,7 +1,7 @@
#!perl
use Test::More;
-use File::Compare;
+use File::Compare qw(compare_text);
BEGIN { require "t/common.pl" }
@@ -48,4 +48,4 @@ truncate(FH, length($txt));
close(FH);
}
-ok(!compare($cmpfile1,$outfile1), $cmpfile1);
+ok(!compare_text($cmpfile1,$outfile1), $cmpfile1);
View
4 t/common.pl
@@ -59,7 +59,7 @@ BEGIN
use Net::LDAP::Util qw(canonical_dn);
use File::Path qw(rmtree);
use File::Basename qw(basename);
-use File::Compare;
+use File::Compare qw(compare_text);
my $pid;
@@ -189,7 +189,7 @@ sub compare_ldif {
$ldif->done; # close the file;
- ok(!compare("$TEMPDIR/${test}-out.ldif", "data/${test}-cmp.ldif"), "data/${test}-cmp.ldif");
+ ok(!compare_text("$TEMPDIR/${test}-out.ldif", "data/${test}-cmp.ldif"), "data/${test}-cmp.ldif");
}
sub ldif_populate {

0 comments on commit 4f2965f

Please sign in to comment.