[Po4a-commits] r2689 - in /trunk/t: 13-splitted.t data-13/ data-13/test0.conf data-13/test0.err data-13/test1.conf data-13/test1.err

barbier at users.alioth.debian.org barbier at users.alioth.debian.org
Sat Oct 27 23:12:28 UTC 2012


Author: barbier
Date: Sat Oct 27 23:12:28 2012
New Revision: 2689

URL: http://svn.debian.org/wsvn/po4a/?sc=1&rev=2689
Log:
Add unit tests for the splitted mode

Added:
    trunk/t/13-splitted.t
    trunk/t/data-13/
    trunk/t/data-13/test0.conf
    trunk/t/data-13/test0.err
    trunk/t/data-13/test1.conf
    trunk/t/data-13/test1.err

Added: trunk/t/13-splitted.t
URL: http://svn.debian.org/wsvn/po4a/trunk/t/13-splitted.t?rev=2689&op=file
==============================================================================
--- trunk/t/13-splitted.t (added)
+++ trunk/t/13-splitted.t Sat Oct 27 23:12:28 2012
@@ -1,0 +1,74 @@
+#! /usr/bin/perl
+# Splitted mode tester.
+
+#########################
+
+use strict;
+use warnings;
+
+my @tests;
+
+mkdir "t/tmp" unless -e "t/tmp";
+
+push @tests, {
+  'run'  => 
+    'LC_ALL=C COLUMNS=80 perl ../po4a -f data-13/test0.conf > tmp/err 2>&1',
+  'test' =>
+    ["diff -u data-13/test0.err tmp/err",
+     "sed -e 's,#: data-23/dot1:1 data-23/dot1:1,#: data-23/dot1:1,' data-05/test0.pot > tmp/test0-mod.pot",
+     "perl compare-po.pl tmp/test0-mod.pot tmp/test0_man.1.pot",
+     "sed -e 's,#: data-23/dot1:1 data-23/dot1:1,#: data-23/dot1:1,' data-23/dot1.pot > tmp/dot1-mod.pot",
+     "perl compare-po.pl tmp/dot1-mod.pot tmp/dot1.pot"],
+  'doc'  => 'splitted mode'
+},
+{
+  'run'  => 
+    'LC_ALL=C COLUMNS=80 perl ../po4a -f data-13/test1.conf > tmp/err 2>&1',
+  'test' =>
+    ["diff -u data-13/test1.err tmp/err",
+     "sed -e 's, data-03/man:[0-9]*,,' tmp/man02.pot > tmp/test1-man02.pot",
+     "perl compare-po.pl data-02/man.po-empty tmp/test1-man02.pot",
+     "msgfilter sed d < data-03/man.po-ok 2>/dev/null | sed -e '/^#[:,]/d' > tmp/test1-man03a.pot",
+     "sed -e '/^#[:,]/d' tmp/man03.pot > tmp/test1-man03b.pot",
+     "perl compare-po.pl tmp/test1-man03a.pot tmp/test1-man03b.pot"],
+  'doc'  => 'splitted mode'
+};
+
+use Test::More tests => 13;
+
+for (my $i=0; $i<scalar @tests; $i++) {
+    chdir "t" || die "Can't chdir to my test directory";
+
+    system("rm -f tmp/* 2>&1");
+
+    my ($val,$name);
+
+    my $cmd=$tests[$i]{'run'};
+    $val=system($cmd);
+
+    $name=$tests[$i]{'doc'}.' runs';
+    ok($val == 0,$name);
+    diag($tests[$i]{'run'}) unless ($val == 0);
+
+    SKIP: {
+        skip ("Command don't run, can't test the validity of its return",1)
+            if $val;
+        my $nb = 0;
+        foreach my $test (@{$tests[$i]{'test'}}) {
+            $nb++;
+            $val=system($test);
+            $name=$tests[$i]{'doc'}."[$nb] returns what is expected";
+            ok($val == 0,$name);
+            unless ($val == 0) {
+                diag ("Failed (retval=$val) on:");
+                diag ($test);
+                diag ("Was created with:");
+                diag ($tests[$i]{'run'});
+            }
+        }
+    }
+
+    chdir ".." || die "Can't chdir back to my root";
+}
+
+0;

Added: trunk/t/data-13/test0.conf
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-13/test0.conf?rev=2689&op=file
==============================================================================
--- trunk/t/data-13/test0.conf (added)
+++ trunk/t/data-13/test0.conf Sat Oct 27 23:12:28 2012
@@ -1,0 +1,6 @@
+[po4a_langs]
+[po4a_paths] tmp/$master.pot $lang:tmp/$master.$lang.po
+
+[type:man] data-05/test0_man.1 $lang:tmp/test0_man.$lang.1
+[type:man] data-23/dot1 $lang:tmp/dot1.$lang
+

Added: trunk/t/data-13/test0.err
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-13/test0.err?rev=2689&op=file
==============================================================================
--- trunk/t/data-13/test0.err (added)
+++ trunk/t/data-13/test0.err Sat Oct 27 23:12:28 2012
@@ -1,0 +1,1 @@
+ (15 entries)

Added: trunk/t/data-13/test1.conf
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-13/test1.conf?rev=2689&op=file
==============================================================================
--- trunk/t/data-13/test1.conf (added)
+++ trunk/t/data-13/test1.conf Sat Oct 27 23:12:28 2012
@@ -1,0 +1,6 @@
+[po4a_langs]
+[po4a_paths] tmp/$master.pot $lang:tmp/$master.$lang.po
+
+[type:man] data-02/man $lang:tmp/man02.$lang master:file=man02
+[type:man] data-03/man $lang:tmp/man03.$lang master:file=man03
+

Added: trunk/t/data-13/test1.err
URL: http://svn.debian.org/wsvn/po4a/trunk/t/data-13/test1.err?rev=2689&op=file
==============================================================================
--- trunk/t/data-13/test1.err (added)
+++ trunk/t/data-13/test1.err Sat Oct 27 23:12:28 2012
@@ -1,0 +1,1 @@
+ (16 entries)




More information about the Po4a-commits mailing list