"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "wine-docs-1.0/po4a/t/02-TransTractors.t" of archive wine-docs-1.0.tar.gz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 #! /usr/bin/perl
2 # MAN module tester.
3
4 #########################
5
6 use strict;
7 use warnings;
8
9 my @tests;
10
11 my @formats=qw(man pod);
12
13 mkdir "t/tmp" unless -e "t/tmp";
14
15 my $diff_po_flags = " -I '^# SOME' -I '^# Test' ".
16 "-I '^\"POT-Creation-Date: ' -I '^\"Content-Transfer-Encoding:'";
17 my $diff_pod_flags= " -I 'This file was generated by po4a' ";
18
19 $tests[0]{'run'} = "perl ../po4a-gettextize -f #format# -m data-02/#format# -p tmp/po";
20 $tests[0]{'test'} = "diff -u -I POT-Creation-Date data-02/#format#.po-empty tmp/po";
21 $tests[0]{'doc'} = "gettextize #format# document with only the original";
22
23 $tests[1]{'run'} = "perl ../po4a-gettextize -f #format# -m data-02/#format# -l data-02/#format#.fr -L ISO-8859-1 -p tmp/po 2>/dev/null";
24 $tests[1]{'test'} = "diff -u $diff_po_flags data-02/#format#.po tmp/po";
25 $tests[1]{'doc'} = "gettextize #format# page with original and translation";
26
27 $tests[2]{'run'} = "cp data-02/#format#.po tmp/po && perl ../po4a-updatepo -f #format# -m data-02/#format# -p tmp/po >/dev/null 2>&1 ";
28 $tests[2]{'test'} = "diff -u $diff_po_flags data-02/#format#.po tmp/po";
29 $tests[2]{'doc'} = "updatepo for #format# document";
30
31 $tests[3]{'run'} = "perl ../po4a-translate -f #format# -m data-02/#format# -p data-02/#format#.po-ok -l tmp/#format#.fr";
32 $tests[3]{'test'} = "diff data-02/#format#.fr-normalized tmp/#format#.fr";
33 $tests[3]{'doc'} = "translate #format# document";
34
35
36 use Test::More tests =>16; # $formats * $tests * 2
37
38 foreach my $format (@formats) {
39 for (my $i=0; $i<scalar @tests; $i++) {
40 chdir "t" || die "Can't chdir to my test directory";
41
42 my ($val,$name);
43
44 my $cmd=$tests[$i]{'run'};
45 $cmd =~ s/#format#/$format/g;
46 $val=system($cmd);
47
48 $name=$tests[$i]{'doc'}.' runs';
49 $name =~ s/#format#/$format/g;
50 ok($val == 0,$name);
51 diag($cmd) unless ($val == 0);
52
53 SKIP: {
54 skip ("Command don't run, can't test the validity of its return",1)
55 if $val;
56 my $testcmd=$tests[$i]{'test'};
57 $testcmd =~ s/#format#/$format/g;
58
59 $val=system($testcmd);
60 $name=$tests[$i]{'doc'}.' returns what is expected';
61 $name =~ s/#format#/$format/g;
62 ok($val == 0,$name);
63 unless ($val == 0) {
64 diag ("Failed (retval=$val) on:");
65 diag ($testcmd);
66 diag ("Was created with:");
67 diag ("'$cmd', with -I../lib");
68 }
69 }
70
71 # system("rm -f tmp/* 2>&1");
72
73 chdir ".." || die "Can't chdir back to my root";
74 }
75 }
76
77 0;
78