[Po4a-commits] r2693 - /trunk/t/30-asciidoc.t
barbier at users.alioth.debian.org
barbier at users.alioth.debian.org
Mon Oct 29 22:43:58 UTC 2012
Author: barbier
Date: Mon Oct 29 22:43:58 2012
New Revision: 2693
URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2693
Log:
Use 'requires' to skip tests if Unicode::GCstring is unavailable
Modified:
trunk/t/30-asciidoc.t
Modified: trunk/t/30-asciidoc.t
URL: http://svn.debian.org/wsvn/po4a/trunk/t/30-asciidoc.t?rev=2693&op=diff
==============================================================================
--- trunk/t/30-asciidoc.t (original)
+++ trunk/t/30-asciidoc.t Mon Oct 29 22:43:58 2012
@@ -12,9 +12,6 @@
mkdir "t/tmp"
or die "Can't create test directory t/tmp: $!\n";
}
-
-my $UGCS = '';
-$UGCS = 'exit 0;' unless (eval { require Unicode::GCString });
my @AsciiDocTests = qw(Titles BlockTitles BlockId Paragraphs
DelimitedBlocks Lists Footnotes Callouts Comments Tables Attributes);
@@ -31,24 +28,28 @@
}
push @tests, {
- 'run' => "$UGCS perl ../../po4a-gettextize -f asciidoc -m ../data-30/Titles.asciidoc -l ../data-30/TitlesUTF8.asciidoc -L UTF-8 -p TitlesUTF8.po",
- 'test'=> "$UGCS perl ../compare-po.pl ../data-30/TitlesUTF8.po TitlesUTF8.po",
- 'doc' => "$UGCS test titles with UTF-8 encoding"
+ 'run' => "perl ../../po4a-gettextize -f asciidoc -m ../data-30/Titles.asciidoc -l ../data-30/TitlesUTF8.asciidoc -L UTF-8 -p TitlesUTF8.po",
+ 'test'=> "perl ../compare-po.pl ../data-30/TitlesUTF8.po TitlesUTF8.po",
+ 'doc' => "test titles with UTF-8 encoding",
+ 'requires' => "Unicode::GCString"
};
push @tests, {
- 'run' => "$UGCS msgattrib --clear-fuzzy -o TitlesUTF8.po TitlesUTF8.po && perl ../../po4a-translate -f asciidoc -m ../data-30/Titles.asciidoc -l TitlesUTF8.asciidoc -p TitlesUTF8.po",
- 'test'=> "$UGCS diff TitlesUTF8.asciidoc ../data-30/TitlesUTF8.asciidoc",
- 'doc' => "$UGCS translate titles with UTF-8 encoding"
+ 'run' => "msgattrib --clear-fuzzy -o TitlesUTF8.po TitlesUTF8.po && perl ../../po4a-translate -f asciidoc -m ../data-30/Titles.asciidoc -l TitlesUTF8.asciidoc -p TitlesUTF8.po",
+ 'test'=> "diff TitlesUTF8.asciidoc ../data-30/TitlesUTF8.asciidoc",
+ 'doc' => "translate titles with UTF-8 encoding",
+ 'requires' => "Unicode::GCString"
};
push @tests, {
- 'run' => "$UGCS perl ../../po4a-gettextize -f asciidoc -m ../data-30/Titles.asciidoc -l ../data-30/TitlesLatin1.asciidoc -L iso-8859-1 -p TitlesLatin1.po",
- 'test'=> "$UGCS perl ../compare-po.pl ../data-30/TitlesLatin1.po TitlesLatin1.po",
- 'doc' => "$UGCS test titles with latin1 encoding"
+ 'run' => "perl ../../po4a-gettextize -f asciidoc -m ../data-30/Titles.asciidoc -l ../data-30/TitlesLatin1.asciidoc -L iso-8859-1 -p TitlesLatin1.po",
+ 'test'=> "perl ../compare-po.pl ../data-30/TitlesLatin1.po TitlesLatin1.po",
+ 'doc' => "test titles with latin1 encoding",
+ 'requires' => "Unicode::GCString"
};
push @tests, {
- 'run' => "$UGCS msgattrib --clear-fuzzy -o TitlesLatin1.po TitlesLatin1.po && perl ../../po4a-translate -f asciidoc -m ../data-30/Titles.asciidoc -l TitlesLatin1.asciidoc -p TitlesLatin1.po",
- 'test'=> "$UGCS diff TitlesLatin1.asciidoc ../data-30/TitlesLatin1.asciidoc",
- 'doc' => "$UGCS translate titles with latin1 encoding"
+ 'run' => "msgattrib --clear-fuzzy -o TitlesLatin1.po TitlesLatin1.po && perl ../../po4a-translate -f asciidoc -m ../data-30/Titles.asciidoc -l TitlesLatin1.asciidoc -p TitlesLatin1.po",
+ 'test'=> "diff TitlesLatin1.asciidoc ../data-30/TitlesLatin1.asciidoc",
+ 'doc' => "translate titles with latin1 encoding",
+ 'requires' => "Unicode::GCString"
};
use Test::More tests => 2 * 14;
@@ -58,13 +59,23 @@
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: {
+ if (defined $test->{'requires'}) {
+ skip ($test->{'requires'}." required for this test", 1)
+ unless eval 'require '.$test->{'requires'};
+ }
+ $val=system($cmd);
+ ok($val == 0,$name);
+ diag($cmd) unless ($val == 0);
+ }
+ SKIP: {
+ if (defined $test->{'requires'}) {
+ skip ($test->{'requires'}." required for this test", 1)
+ unless eval 'require '.$test->{'requires'};
+ }
skip ("Command didn't run, can't test the validity of its return",1)
if $val;
$val=system($test->{'test'});
More information about the Po4a-commits
mailing list