root/lang/perl/Pod-L10N/trunk/t/11_substitute.t @ 33791

Revision 33791, 1.3 kB (checked in by argrath, 4 years ago)

Checking in changes prior to tagging of version 0.03_02. Changelog diff is:

Index: Changes
===================================================================
--- Changes (リビジョン 33769)
+++ Changes (作業コピー)
@@ -1,5 +1,9 @@

Revision history for Perl extension Pod::L10N.


+0.03_02 Thu Jun 5 00:57:10 JST 2009
+
+ - eliminate some warnings
+

0.03_01 Thu Jun 4 00:23:12 JST 2009


  • change base to Pod::Html 1.09_04
  • Property svn:executable set to *
Line 
1use Test::More tests => 1;
2
3use Cwd;
4use Pod::L10N::Html;
5use Config;
6use File::Spec::Functions;
7
8BEGIN {
9    chdir 't' if -d 't';
10    unshift @INC, qw( ../lib ../lib/Pod/t );
11}
12
13END {
14    # pod2html creates these
15    1 while unlink "pod2htmd.tmp";
16    1 while unlink "pod2htmi.tmp";
17}
18
19my $CWD      = Cwd::cwd();
20my $CACHEDIR = "$CWD/subdir";
21
22# l10n conversion
23convert_ok("substitute.pod", "substitute.html", "l10n substitution");
24
25sub slurp {
26    my $file = shift;
27    open my $in, $file or die "cannot open $file for input: $!";
28    local $/ = undef;
29    my $rec = <$in>;
30    close $in;
31    return $rec;
32}
33
34sub convert_ok {
35    my $podfile  = shift;
36    my $htmlfile = shift;
37    my $testname = shift;
38    my @extra_args = @{shift || []};
39
40    my $base_dir = catdir $CWD, updir(), $ENV{PERL_CORE} ? ("lib", "Pod") : (curdir());
41    my $infile   = $podfile;
42    my $outfile  = "$htmlfile-t";
43
44    Pod::L10N::Html::pod2html(
45        "--podpath=t",
46        "--podroot=$base_dir",
47        "--infile=$infile",
48        "--outfile=$outfile",
49        @extra_args,
50    );
51
52    my $result = slurp($outfile);
53
54    my $expect = slurp($htmlfile);
55    $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
56
57    is($expect, $result, $testname) and do {
58        # remove the results if the test succeeded
59        1 while unlink $outfile;
60    };
61}
62
Note: See TracBrowser for help on using the browser.