1# encoding nonesuch
2BEGIN {
3    if($ENV{PERL_CORE}) {
4        chdir 't';
5        @INC = '../lib';
6    }
7}
8
9#use Pod::Simple::Debug (10);
10use Test;
11use File::Spec;
12#use utf8;
13use strict;
14#use Pod::Simple::Debug (10);
15
16BEGIN { plan tests => 6 }
17
18use Pod::Simple;
19use Pod::Simple::DumpAsXML;
20
21my $thefile;
22
23
24BEGIN {
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.
28sub 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
61print "# Testing that $thefile parses right.\n";
62my $outstring;
63{
64  my $p = Pod::Simple::DumpAsXML->new;
65  $p->output_string( \$outstring );
66  $p->parse_file( $thefile );
67  undef $p;
68}
69ok 1 ; # make sure it parsed at all
70ok( $outstring && length($outstring) ); # make sure it parsed to something.
71#print $outstring;
72ok( $outstring =~ m/Blorp/ );
73ok( $outstring =~ m/errata/ );
74ok( $outstring =~ m/unsupported/ );
75ok 1;
76