[Po4a-commits] "po4a/t 29-wml.t,NONE,1.1"

Noritada Kobayashi nori1-guest at alioth.debian.org
Wed Mar 19 09:04:56 UTC 2008


Update of /cvsroot/po4a/po4a/t
In directory alioth:/tmp/cvs-serv706/t

Added Files:
	29-wml.t 
Log Message:
* t/29-wml.t, t/data-29/general-normalized.wml, t/data-29/general.po, 
t/data-29/general.wml: New test and its data for the Wml module.


--- NEW FILE: 29-wml.t ---
#! /usr/bin/perl
# Wml 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-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",
  'doc' => 'normalisation test',
  };

use Test::More tests => 2;

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