[Po4a-commits] "po4a/t 25-xhtml.t,NONE,1.1"
Nicolas FRANCOIS
nekral-guest at alioth.debian.org
Tue Jun 13 20:59:17 UTC 2006
Update of /cvsroot/po4a/po4a/t
In directory haydn:/tmp/cvs-serv20299/t
Added Files:
25-xhtml.t
Log Message:
Add an Xhtml testsuite. Thanks to Yves Rütschlé.
--- NEW FILE: 25-xhtml.t ---
#! /usr/bin/perl
# Xhtml module tester.
#########################
use strict;
use warnings;
my @tests;
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",
'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",
'doc' => 'normalisation test',
};
use Test::More tests => 4;
chdir "t/tmp" || die "Can't chdir to my test directory";
foreach my $test ( @tests ) {
my ($val,$name);
my $cmd=$test->{'run'};
$val=system($cmd);
$name=$test->{'doc'}.' runs';
ok($val == 0,$name);
diag($test->{'run'}) unless ($val == 0);
SKIP: {
skip ("Command didn't run, can't test the validity of its return",1)
if $val;
$val=system($test->{'test'});
$name=$test->{'doc'}.' returns what is expected';
ok($val == 0,$name);
unless ($val == 0) {
diag ("Failed (retval=$val) on:");
diag ($test->{'test'});
diag ("Was created with:");
diag ($test->{'run'});
}
}
}
chdir "../.." || die "Can't chdir back to my root";
0;
More information about the Po4a-commits
mailing list