[Po4a-commits] po4a/t 23-man.t,NONE,1.1
Nicolas FRAN??OIS
po4a-devel@lists.alioth.debian.org
Sun, 28 Nov 2004 21:52:40 +0000
- Previous message: [Po4a-commits] po4a/t/data-23 - New directory
- Next message: [Po4a-commits] po4a/t/data-23 dot1,NONE,1.1 dot1.fr,NONE,1.1 dot1.fr.po,NONE,1.1 dot1.pot,NONE,1.1 dot2,NONE,1.1 dot2.err,NONE,1.1 dot3,NONE,1.1 dot3.err,NONE,1.1 dot4,NONE,1.1 dot4.err,NONE,1.1 null,NONE,1.1 null.fr,NONE,1.1 null.fr.po,NONE,1.1 null.pot,NONE,1.1 quotes,NONE,1.1 quotes.fr,NONE,1.1 quotes.fr.po,NONE,1.1 quotes.pot,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/po4a/po4a/t
In directory haydn:/tmp/cvs-serv17686
Added Files:
23-man.t
Log Message:
Add a framework for the Man module's unit tests.
--- NEW FILE: 23-man.t ---
#! /usr/bin/perl
# XML module tester.
#########################
use strict;
use warnings;
my @tests;
my @formats=qw(man);
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' ";
# Quotes
$tests[0]{'run'} = "perl ../po4a-gettextize -f #format# -m data-23/quotes -p tmp/quotes.pot 2>/dev/null";
$tests[0]{'test'} = "diff -u tmp/quotes.pot data-23/quotes.pot $diff_po_flags";
$tests[0]{'doc'} = "gettextize well various quotes";
$tests[1]{'run'} = "cp data-23/quotes.fr.po tmp/ && perl ../po4a-updatepo -f #format# -m data-23/quotes -p tmp/quotes.fr.po >/dev/null 2>&1 ";
$tests[1]{'test'} = "diff -u $diff_po_flags data-23/quotes.fr.po tmp/quotes.fr.po";
$tests[1]{'doc'} = "updatepo for this document";
$tests[2]{'run'} = "perl ../po4a-translate -f #format# -m data-23/quotes -p data-23/quotes.fr.po -l tmp/quotes.fr";
$tests[2]{'test'} = "diff -u $diff_pod_flags data-23/quotes.fr tmp/quotes.fr";
$tests[2]{'doc'} = "translate this document";
# Dots
$tests[3]{'run'} = "perl ../po4a-gettextize -f #format# -m data-23/dot1 -p tmp/dot1.pot 2>/dev/null";
$tests[3]{'test'} = "diff -u tmp/dot1.pot data-23/dot1.pot $diff_po_flags";
$tests[3]{'doc'} = "gettextize well various lines beginning by a dot (1)";
$tests[4]{'run'} = "cp data-23/dot1.fr.po tmp/ && perl ../po4a-updatepo -f #format# -m data-23/dot1 -p tmp/dot1.fr.po >/dev/null 2>&1 ";
$tests[4]{'test'} = "diff -u $diff_po_flags data-23/dot1.fr.po tmp/dot1.fr.po";
$tests[4]{'doc'} = "updatepo for this document";
$tests[5]{'run'} = "perl ../po4a-translate -f #format# -m data-23/dot1 -p data-23/dot1.fr.po -l tmp/dot1.fr";
$tests[5]{'test'} = "diff -u $diff_pod_flags data-23/dot1.fr tmp/dot1.fr";
$tests[5]{'doc'} = "translate this document";
$tests[6]{'run'} = "LC_ALL=C perl ../po4a-gettextize -f #format# -m data-23/dot2 -p tmp/dot2.pot 2>tmp/dot2.err || true";
$tests[6]{'test'} = "diff -u tmp/dot2.err data-23/dot2.err $diff_po_flags";
$tests[6]{'doc'} = "gettextize well various lines beginning by a dot (2)";
$tests[7]{'run'} = "LC_ALL=C perl ../po4a-gettextize -f #format# -m data-23/dot3 -p tmp/dot3.pot 2>tmp/dot3.err || true";
$tests[7]{'test'} = "diff -u tmp/dot3.err data-23/dot3.err $diff_po_flags";
$tests[7]{'doc'} = "gettextize well various lines beginning by a dot (3)";
$tests[8]{'run'} = "LC_ALL=C perl ../po4a-gettextize -f #format# -m data-23/dot4 -p tmp/dot4.pot 2>tmp/dot4.err || true";
$tests[8]{'test'} = "diff -u tmp/dot4.err data-23/dot4.err $diff_po_flags";
$tests[8]{'doc'} = "gettextize well various lines beginning by a dot (4)";
# Null argument
$tests[9]{'run'} = "LC_ALL=C perl ../po4a-gettextize -f #format# -m data-23/null -p tmp/null.pot 2>/dev/null";
$tests[9]{'test'} = "diff -u tmp/null.pot data-23/null.pot $diff_po_flags";
$tests[9]{'doc'} = "gettextize well null argument/paragraphs";
$tests[10]{'run'} = "cp data-23/null.fr.po tmp/ && perl ../po4a-updatepo -f #format# -m data-23/null -p tmp/null.fr.po >/dev/null 2>&1 ";
$tests[10]{'test'} = "diff -u $diff_po_flags data-23/null.fr.po tmp/null.fr.po";
$tests[10]{'doc'} = "updatepo for this document";
$tests[11]{'run'} = "perl ../po4a-translate -f #format# -m data-23/null -p data-23/null.fr.po -l tmp/null.fr";
$tests[11]{'test'} = "diff -u $diff_pod_flags data-23/null.fr tmp/null.fr";
$tests[11]{'doc'} = "translate this document";
use Test::More tests =>24; # $formats * $tests * 2
foreach my $format (@formats) {
for (my $i=0; $i<scalar @tests; $i++) {
chdir "t" || die "Can't chdir to my test directory";
my ($val,$name);
my $cmd=$tests[$i]{'run'};
$cmd =~ s/#format#/$format/g;
$val=system($cmd);
$name=$tests[$i]{'doc'}.' runs';
$name =~ s/#format#/$format/g;
ok($val == 0,$name);
diag($cmd) unless ($val == 0);
SKIP: {
skip ("Command don't run, can't test the validity of its return",1)
if $val;
my $testcmd=$tests[$i]{'test'};
$testcmd =~ s/#format#/$format/g;
$val=system($testcmd);
$name=$tests[$i]{'doc'}.' returns what is expected';
$name =~ s/#format#/$format/g;
ok($val == 0,$name);
unless ($val == 0) {
diag ("Failed (retval=$val) on:");
diag ($testcmd);
diag ("Was created with:");
diag ("perl -I../lib $cmd");
}
}
# system("rm -f tmp/* 2>&1");
chdir ".." || die "Can't chdir back to my root";
}
}
0;
- Previous message: [Po4a-commits] po4a/t/data-23 - New directory
- Next message: [Po4a-commits] po4a/t/data-23 dot1,NONE,1.1 dot1.fr,NONE,1.1 dot1.fr.po,NONE,1.1 dot1.pot,NONE,1.1 dot2,NONE,1.1 dot2.err,NONE,1.1 dot3,NONE,1.1 dot3.err,NONE,1.1 dot4,NONE,1.1 dot4.err,NONE,1.1 null,NONE,1.1 null.fr,NONE,1.1 null.fr.po,NONE,1.1 null.pot,NONE,1.1 quotes,NONE,1.1 quotes.fr,NONE,1.1 quotes.fr.po,NONE,1.1 quotes.pot,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]