Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libpod-simple-perl / libpod-simple-perl-3.07 / t / encod01.t
1 # encoding nonesuch
2 BEGIN {
3     if($ENV{PERL_CORE}) {
4         chdir 't';
5         @INC = '../lib';
6     }
7 }
8
9 #use Pod::Simple::Debug (10);
10 use Test;
11 use File::Spec;
12 #use utf8;
13 use strict;
14 #use Pod::Simple::Debug (10);
15
16 BEGIN { plan tests => 6 }
17
18 use Pod::Simple;
19 use Pod::Simple::DumpAsXML;
20
21 my $thefile;
22
23
24 BEGIN { 
25
26   # Find the path to the test source files.  This requires some fiddling when
27 # these tests are run as part of Perl core.
28 sub source_path {
29     my $file = shift;
30     if ($ENV{PERL_CORE}) {
31         require File::Spec;
32         my $updir = File::Spec->updir;
33         my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 'Simple', 't', 'corpus');
34         return File::Spec->catfile ($dir, $file);
35     } else {
36         return $file;
37     }
38 }
39   if( -e
40     ($thefile = source_path('nonesuch.txt'))
41    #or (print("# Nope, not $thefile\n"), 0)
42   ) {
43     # okay,
44
45   } elsif( -e
46     ($thefile = File::Spec::->catfile( File::Spec::->curdir, 'corpus', 'nonesuch.txt' ))
47    #or (print("# Nope, not $thefile\n"), 0)
48   ) {
49     # okay,
50   } elsif (-e
51     ($thefile = File::Spec::->catfile( File::Spec::->curdir, 't', 'corpus', 'nonesuch.txt' ))
52    #or (print("# Nope, not $thefile\n"), 0)
53   ) {
54     # okay,
55   } else {
56     die "Can't find the corpus directory\n Aborting";
57   }
58
59 }
60
61 print "# Testing that $thefile parses right.\n";
62 my $outstring;
63 {
64   my $p = Pod::Simple::DumpAsXML->new;
65   $p->output_string( \$outstring );
66   $p->parse_file( $thefile );
67   undef $p;
68 }
69 ok 1 ; # make sure it parsed at all
70 ok( $outstring && length($outstring) ); # make sure it parsed to something.
71 #print $outstring;
72 ok( $outstring =~ m/Blorp/ );
73 ok( $outstring =~ m/errata/ );
74 ok( $outstring =~ m/unsupported/ );
75 ok 1;