[Po4a-commits] "po4a/t 02-TransTractors.t, 1.12, 1.13 04-charsets.t, 1.3, 1.4 10-discard-fuzzy.t, 1.6, 1.7 11-plural.t, 1.1, 1.2 20-sgml.t, 1.8, 1.9 21-dia.t, 1.3, 1.4 22-html.t, 1.1, 1.2 25-xhtml.t, 1.2, 1.3 26-ini.t, 1.2, 1.3 27-xml.t, 1.3, 1.4 29-wml.t, 1.1, 1.2 30-text.t, 1.2, 1.3 compare-po.pl, NONE, 1.1"
Denis Barbier
barbier-guest at alioth.debian.org
Fri Jul 30 21:11:32 UTC 2010
Update of /cvsroot/po4a/po4a/t
In directory alioth:/tmp/cvs-serv3933
Modified Files:
02-TransTractors.t 04-charsets.t 10-discard-fuzzy.t
11-plural.t 20-sgml.t 21-dia.t 22-html.t 25-xhtml.t 26-ini.t
27-xml.t 29-wml.t 30-text.t
Added Files:
compare-po.pl
Log Message:
New script used by tests: compare-po.pl
This script removes header entries of PO files
and compare their content. This is very useful,
since we update headers from time to time.
Update comment in generated POD file to match
the current usage.
--- NEW FILE: compare-po.pl ---
#! /usr/bin/perl
# Remove header entry of two PO files and compare them
my $f1 = shift(@ARGV);
my $f2 = shift(@ARGV);
open IN1, "<", $f1 or die "Unable to read 1st file: $!\n";
open IN2, "<", $f2 or die "Unable to read 2nd file: $!\n";
my $inMsgstr = 0;
my $lineno = 0;
while (<IN1>) {
$lineno ++;
if (m/^msgstr/) {
$inMsgstr = 1;
} elsif ($inMsgstr == 1 && $_ !~ /^"/) {
last;
}
}
$inMsgstr = 0;
while (<IN2>) {
if (m/^msgstr/) {
$inMsgstr = 1;
} elsif ($inMsgstr == 1 && $_ !~ /^"/) {
last;
}
}
# Now compare lines
while (<IN1>) {
$lineno ++;
my $l2 = <IN2> or die "Unexpected EOF found when reading $f2\n";
$_ eq $l2 or die "Files $f1 and $f2 differ at line $lineno:\n-$_+$l2\n";
}
close IN1;
die "EOF expected at 2nd file\n" unless eof(IN2);
close IN2;
exit 0;
Index: 02-TransTractors.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/02-TransTractors.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- 02-TransTractors.t 19 Jul 2010 19:55:03 -0000 1.12
+++ 02-TransTractors.t 30 Jul 2010 21:10:42 -0000 1.13
@@ -12,20 +12,16 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:' -I '^\"Language: ' -I '^# *\n'";
-my $diff_pod_flags= " -I 'This file was generated by po4a' ";
-
$tests[0]{'run'} = "perl ../po4a-gettextize -f #format# -m data-02/#format# -p tmp/po";
-$tests[0]{'test'} = "diff -u -I POT-Creation-Date data-02/#format#.po-empty tmp/po";
+$tests[0]{'test'} = "perl compare-po.pl data-02/#format#.po-empty tmp/po";
$tests[0]{'doc'} = "gettextize #format# document with only the original";
$tests[1]{'run'} = "perl ../po4a-gettextize -f #format# -m data-02/#format# -l data-02/#format#.fr -L ISO-8859-1 -p tmp/po 2>/dev/null";
-$tests[1]{'test'} = "diff -u $diff_po_flags data-02/#format#.po tmp/po";
+$tests[1]{'test'} = "perl compare-po.pl data-02/#format#.po tmp/po";
$tests[1]{'doc'} = "gettextize #format# page with original and translation";
$tests[2]{'run'} = "cp data-02/#format#.po tmp/po && perl ../po4a-updatepo -f #format# -m data-02/#format# -p tmp/po >/dev/null 2>&1 ";
-$tests[2]{'test'} = "diff -u $diff_po_flags data-02/#format#.po tmp/po";
+$tests[2]{'test'} = "perl compare-po.pl data-02/#format#.po tmp/po";
$tests[2]{'doc'} = "updatepo for #format# document";
$tests[3]{'run'} = "perl ../po4a-translate -f #format# -m data-02/#format# -p data-02/#format#.po-ok -l tmp/#format#.fr";
Index: 21-dia.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/21-dia.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 21-dia.t 9 Aug 2004 17:26:00 -0000 1.3
+++ 21-dia.t 30 Jul 2010 21:11:02 -0000 1.4
@@ -10,11 +10,8 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
$tests[0]{'run'} = 'perl ../po4a-gettextize -f dia -m data-21/extract.dia -p tmp/dia_extract.po';
-$tests[0]{'test'} = "diff -u $diff_po_flags data-21/extract.po-ok tmp/dia_extract.po";
+$tests[0]{'test'} = 'perl compare-po.pl data-21/extract.po-ok tmp/dia_extract.po';
$tests[0]{'doc'} = 'get only needed strings';
$tests[1]{'run'} = 'perl ../po4a-translate -f dia -m data-21/transl.dia -p data-21/transl.po -l tmp/transl.dia';
Index: 04-charsets.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/04-charsets.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 04-charsets.t 9 Aug 2004 15:13:25 -0000 1.3
+++ 04-charsets.t 30 Jul 2010 21:10:43 -0000 1.4
@@ -10,31 +10,28 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
$tests[0]{'run'} = 'perl ../po4a-gettextize -f pod -m data-04/text-ascii.pod -M iso-8859-1 -p tmp/ascii.po';
-$tests[0]{'test'} = "diff -u $diff_po_flags data-04/ascii.po-ok tmp/ascii.po";
+$tests[0]{'test'} = 'perl compare-po.pl data-04/ascii.po-ok tmp/ascii.po';
$tests[0]{'doc'} = 'using ascii when it\'s enough';
$tests[1]{'run'} = 'perl ../po4a-gettextize -f pod -m data-04/text-iso8859.pod -M iso-8859-1 -p tmp/iso8859.po';
-$tests[1]{'test'} = "diff -u $diff_po_flags data-04/iso8859.po-ok tmp/iso8859.po";
+$tests[1]{'test'} = 'perl compare-po.pl data-04/iso8859.po-ok tmp/iso8859.po';
$tests[1]{'doc'} = 'use utf-8 when master file is non-ascii';
$tests[2]{'run'} = 'perl ../po4a-gettextize -f pod -m data-04/text-ascii.pod -l data-04/text-iso8859.pod -L iso-8859-1 -p tmp/ascii-iso8859.po';
-$tests[2]{'test'} = "diff -u $diff_po_flags data-04/ascii-iso8859.po-ok tmp/ascii-iso8859.po";
+$tests[2]{'test'} = 'perl compare-po.pl data-04/ascii-iso8859.po-ok tmp/ascii-iso8859.po';
$tests[2]{'doc'} = 'using translation\'s encoding when master is ascii';
$tests[3]{'run'} = 'perl ../po4a-translate -f pod -m data-04/text-ascii.pod -p data-04/trans.po -l tmp/text-iso8859.pod';
-$tests[3]{'test'} = "diff -u $diff_po_flags data-04/text-iso8859.pod-ok tmp/text-iso8859.pod";
+$tests[3]{'test'} = 'perl compare-po.pl data-04/text-iso8859.pod-ok tmp/text-iso8859.pod';
$tests[3]{'doc'} = 'translation without recoding output';
$tests[4]{'run'} = 'perl ../po4a-gettextize -f pod -m data-04/text-iso8859_.pod -M iso-8859-1 -l data-04/text-iso8859.pod -L iso-8859-1 -p tmp/utf.po';
-$tests[4]{'test'} = "diff -u $diff_po_flags data-04/utf.po-ok tmp/utf.po";
+$tests[4]{'test'} = 'perl compare-po.pl data-04/utf.po-ok tmp/utf.po';
$tests[4]{'doc'} = 'convert msgstrs to utf-8 when master file is non-ascii';
$tests[5]{'run'} = 'perl ../po4a-translate -f pod -m data-04/text-ascii.pod -p data-04/utf.po -l tmp/utf.pod';
-$tests[5]{'test'} = "diff -u $diff_po_flags data-04/utf.pod-ok tmp/utf.pod";
+$tests[5]{'test'} = 'perl compare-po.pl data-04/utf.pod-ok tmp/utf.pod';
$tests[5]{'doc'} = 'use input po\'s charset';
use Test::More tests =>12; # tests * (run+validity)
Index: 29-wml.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/29-wml.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 29-wml.t 19 Mar 2008 09:04:53 -0000 1.1
+++ 29-wml.t 30 Jul 2010 21:11:19 -0000 1.2
@@ -10,13 +10,10 @@
mkdir "t/tmp" unless -e "t/tmp" or die "Can't create test directory t/tmp\n";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
push @tests, {
'run' => 'perl ../../po4a-normalize -f wml ../data-29/general.wml',
- 'test'=> "diff -u $diff_po_flags ../data-29/general.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-29/general-normalized.wml po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-29/general.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-29/general-normalized.wml po4a-normalize.output',
'doc' => 'normalisation test',
};
Index: 10-discard-fuzzy.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/10-discard-fuzzy.t,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- 10-discard-fuzzy.t 26 Oct 2005 10:54:26 -0000 1.6
+++ 10-discard-fuzzy.t 30 Jul 2010 21:10:45 -0000 1.7
@@ -12,8 +12,6 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
my $diff_pod_flags= " -I 'This file was generated by po4a' ";
$tests[0]{'run'} = "perl ../po4a-translate -f pod -k 0 -m data-10/pod -p data-10/pod.po -l tmp/pod.fr";
Index: 11-plural.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/11-plural.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 11-plural.t 15 Sep 2007 17:05:32 -0000 1.1
+++ 11-plural.t 30 Jul 2010 21:10:50 -0000 1.2
@@ -12,9 +12,6 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test'".
- " -I '^\"POT-Creation-Date: '".
- " -I '^\"Content-Transfer-Encoding:'";
my $diff_pod_flags= " -I 'This file was generated by po4a' ";
$tests[0]{'run'} = "perl ../po4a-translate -f pod -k 0 -m data-11/pod1 -p data-11/pod1.po -l tmp/pod1.fr";
Index: 20-sgml.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/20-sgml.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- 20-sgml.t 15 Sep 2007 18:05:04 -0000 1.8
+++ 20-sgml.t 30 Jul 2010 21:10:56 -0000 1.9
@@ -12,18 +12,14 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-my $diff_pod_flags= " -I 'This file was generated by po4a' ";
-
$tests[0]{'run'} = "perl ../po4a-gettextize -f #format# -o force -m data-20/text.xml -p tmp/xml.po";
-$tests[0]{'test'} = "diff -u data-20/xml.po tmp/xml.po $diff_po_flags";
+$tests[0]{'test'} = "perl compare-po.pl data-20/xml.po tmp/xml.po";
$tests[0]{'doc'} = "gettextize well simple xml documents";
$tests[0]{'requires'} = "Text::WrapI18N";
$tests[1]{'run'} = 'cd tmp && perl ../../po4a-normalize -f sgml ../data-20/test2.sgml';
-$tests[1]{'test'} = "diff -u $diff_po_flags data-20/test2.pot tmp/po4a-normalize.po".
- "&& diff -u $diff_po_flags data-20/test2-normalized.sgml tmp/po4a-normalize.output";
+$tests[1]{'test'} = 'perl compare-po.pl data-20/test2.pot tmp/po4a-normalize.po'.
+ ' && perl compare-po.pl data-20/test2-normalized.sgml tmp/po4a-normalize.output';
$tests[1]{'doc'} = 'normalisation test';
use Test::More tests =>4; # $formats * $tests * 2
Index: 27-xml.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/27-xml.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 27-xml.t 2 Mar 2008 14:12:04 -0000 1.3
+++ 27-xml.t 30 Jul 2010 21:11:13 -0000 1.4
@@ -10,25 +10,22 @@
mkdir "t/tmp" unless -e "t/tmp" or die "Can't create test directory t/tmp\n";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
push @tests, {
'run' => 'perl ../../po4a-normalize -f guide ../data-27/general.xml',
- 'test'=> "diff -u $diff_po_flags ../data-27/general.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-27/general-normalized.xml po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-27/general.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-27/general-normalized.xml po4a-normalize.output',
'doc' => 'normalisation test',
};
push @tests, {
'run' => 'perl ../../po4a-normalize -f guide ../data-27/comments.xml',
- 'test'=> "diff -u $diff_po_flags ../data-27/comments.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-27/comments-normalized.xml po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-27/comments.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-27/comments-normalized.xml po4a-normalize.output',
'doc' => 'normalisation test',
};
push @tests, {
- 'run' => 'perl ../../po4a-normalize -f xml -o translated="w<translate1w> W<translate2W> <translate5> i<inline6> " -o untranslated="<untranslated4>" ../data-27/options.xml',
- 'test'=> "diff -u $diff_po_flags ../data-27/options.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-27/options-normalized.xml po4a-normalize.output",
+ 'run' => "perl ../../po4a-normalize -f xml -o translated='w<translate1w> W<translate2W> <translate5> i<inline6> ' -o untranslated='<untranslated4>' ../data-27/options.xml",
+ 'test'=> 'perl ../compare-po.pl ../data-27/options.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-27/options-normalized.xml po4a-normalize.output',
'doc' => 'normalisation test',
};
Index: 30-text.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/30-text.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 30-text.t 9 Feb 2009 21:34:13 -0000 1.2
+++ 30-text.t 30 Jul 2010 21:11:21 -0000 1.3
@@ -13,12 +13,6 @@
or die "Can't create test directory t/tmp: $!\n";
}
-my $diff_po_flags = "-I '^# SOME' ".
- "-I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' ".
- "-I '^\"Content-Transfer-Encoding:' ".
- "-I '^\"PO-Revision-Date: ' ";
-
my @AsciiDocTests = qw(Titles BlockTitles BlockId Paragraphs
DelimitedBlocks Lists Footnotes Callouts Tables Attributes);
@@ -27,8 +21,8 @@
next if $AsciiDocTest =~ m/Tables/;
push @tests, {
'run' => "perl ../../po4a-normalize -f text -o asciidoc ../data-30/$AsciiDocTest.asciidoc",
- 'test'=> "diff -u $diff_po_flags ../data-30/$AsciiDocTest.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-30/$AsciiDocTest.out po4a-normalize.output",
+ 'test'=> "perl ../compare-po.pl ../data-30/$AsciiDocTest.po po4a-normalize.po".
+ "&& perl ../compare-po.pl ../data-30/$AsciiDocTest.out po4a-normalize.output",
'doc' => "$AsciiDocTest test"
};
}
Index: 25-xhtml.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/25-xhtml.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 25-xhtml.t 15 Mar 2008 01:20:00 -0000 1.2
+++ 25-xhtml.t 30 Jul 2010 21:11:11 -0000 1.3
@@ -10,22 +10,19 @@
mkdir "t/tmp" unless -e "t/tmp" or die "Can't create test directory t/tmp\n";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
push @tests, {
'run' => 'perl ../../po4a-gettextize -f xhtml -m ../data-25/xhtml.html -p xhtml.po',
- 'test'=> "diff -u $diff_po_flags ../data-25/xhtml.po xhtml.po",
+ 'test'=> 'perl ../compare-po.pl ../data-25/xhtml.po xhtml.po',
'doc' => 'Text extraction',
}, {
'run' => 'perl ../../po4a-normalize -f xhtml ../data-25/xhtml.html',
- 'test'=> "diff -u $diff_po_flags ../data-25/xhtml.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-25/xhtml_normalized.html po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-25/xhtml.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-25/xhtml_normalized.html po4a-normalize.output',
'doc' => 'normalisation test',
}, {
'run' => 'perl ../../po4a-normalize -f xhtml -o includessi ../data-25/includessi.html',
- 'test'=> "diff -u $diff_po_flags ../data-25/includessi.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-25/includessi_normalized.html po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-25/includessi.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-25/includessi_normalized.html po4a-normalize.output',
'doc' => 'includessi test',
};
Index: 22-html.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/22-html.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 22-html.t 28 Nov 2004 22:38:57 -0000 1.1
+++ 22-html.t 30 Jul 2010 21:11:08 -0000 1.2
@@ -10,24 +10,21 @@
mkdir "t/tmp" unless -e "t/tmp";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
push @tests, {
'run' => 'perl ../../po4a-gettextize -f html -m ../data-22/html.html -p html.po',
- 'test'=> "diff -u $diff_po_flags ../data-22/html.po html.po",
+ 'test'=> 'perl ../compare-po.pl ../data-22/html.po html.po',
'doc' => 'General',
}, {
'run' => 'perl ../../po4a-normalize -f html ../data-22/spaces.html',
- 'test'=> "diff -u $diff_po_flags ../data-22/spaces.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-22/spaces_out.html po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-22/spaces.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-22/spaces_out.html po4a-normalize.output',
'doc' => 'Spaces',
}, {
'run' => 'perl ../../po4a-gettextize -f html -m ../data-22/attribute.html -p attribute.po;'.
'sed "s/msgstr \"\"/msgstr \"baz\"/" attribute.po > attribute2.po;'.
'perl ../../po4a-translate -f html -m ../data-22/attribute.html -p attribute2.po -l attribute.html'
,
- 'test'=> "diff -u $diff_po_flags ../data-22/attribute_out.html attribute.html",
+ 'test'=> 'perl ../compare-po.pl ../data-22/attribute_out.html attribute.html',
'doc' => 'Attribute replacement'
};
Index: 26-ini.t
===================================================================
RCS file: /cvsroot/po4a/po4a/t/26-ini.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 26-ini.t 31 Dec 2006 16:31:33 -0000 1.2
+++ 26-ini.t 30 Jul 2010 21:11:12 -0000 1.3
@@ -10,13 +10,10 @@
mkdir "t/tmp" unless -e "t/tmp" or die "Can't create test directory t/tmp\n";
-my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
- "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
-
push @tests, {
'run' => 'perl ../../po4a-normalize -f ini ../data-26/test1.ini',
- 'test'=> "diff -u $diff_po_flags ../data-26/test1.po po4a-normalize.po".
- "&& diff -u $diff_po_flags ../data-26/test1.ini po4a-normalize.output",
+ 'test'=> 'perl ../compare-po.pl ../data-26/test1.po po4a-normalize.po'.
+ ' && perl ../compare-po.pl ../data-26/test1.ini po4a-normalize.output',
'doc' => 'normalisation test',
};
More information about the Po4a-commits
mailing list