Perldoc.pm tweak for VMS
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / text.t
CommitLineData
f011ec7d 1#!/usr/bin/perl -w
2# $Id: text.t,v 1.1 2002/06/23 19:16:25 eagle Exp $
3#
4# text.t -- Additional specialized tests for Pod::Text.
5#
6# Copyright 2002 by Russ Allbery <rra@stanford.edu>
7#
8# This program is free software; you may redistribute it and/or modify it
9# under the same terms as Perl itself.
10
11BEGIN {
12 chdir 't' if -d 't';
13 if ($ENV{PERL_CORE}) {
14 @INC = '../lib';
15 } else {
16 unshift (@INC, '../blib/lib');
17 }
18 unshift (@INC, '../blib/lib');
19 $| = 1;
20 print "1..2\n";
21}
22
23END {
24 print "not ok 1\n" unless $loaded;
25}
26
27use Pod::Text;
28
29$loaded = 1;
30print "ok 1\n";
31
32my $n = 2;
33while (<DATA>) {
34 next until $_ eq "###\n";
35 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
36 while (<DATA>) {
37 last if $_ eq "###\n";
38 print TMP $_;
39 }
40 close TMP;
41 my $parser = Pod::Text->new or die "Cannot create parser\n";
42 $parser->parse_from_file ('tmp.pod', 'out.tmp');
43 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
44 my $output;
45 {
46 local $/;
47 $output = <TMP>;
48 }
49 close TMP;
50 unlink ('tmp.pod', 'out.tmp');
51 my $expected = '';
52 while (<DATA>) {
53 last if $_ eq "###\n";
54 $expected .= $_;
55 }
56 if ($output eq $expected) {
57 print "ok $n\n";
58 } else {
59 print "not ok $n\n";
60 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
61 }
62 $n++;
63}
64
65# Below the marker are bits of POD and corresponding expected text output.
66# This is used to test specific features or problems with Pod::Text. The
67# input and output are separated by lines containing only ###.
68
69__DATA__
70
71###
72=head1 PERIODS
73
74This C<.> should be quoted.
75###
76PERIODS
77 This "." should be quoted.
78
79###