Mark all .t and .pm files as non executable
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / text.t
CommitLineData
f011ec7d 1#!/usr/bin/perl -w
f011ec7d 2#
3# text.t -- Additional specialized tests for Pod::Text.
4#
9d1cda07 5# Copyright 2002, 2004, 2006, 2007, 2008, 2009 Russ Allbery <rra@stanford.edu>
f011ec7d 6#
7# This program is free software; you may redistribute it and/or modify it
8# under the same terms as Perl itself.
9
10BEGIN {
11 chdir 't' if -d 't';
12 if ($ENV{PERL_CORE}) {
13 @INC = '../lib';
14 } else {
15 unshift (@INC, '../blib/lib');
16 }
17 unshift (@INC, '../blib/lib');
18 $| = 1;
9d1cda07 19 print "1..6\n";
f011ec7d 20}
21
22END {
23 print "not ok 1\n" unless $loaded;
24}
25
26use Pod::Text;
40dcca8a 27use Pod::Simple;
f011ec7d 28
29$loaded = 1;
30print "ok 1\n";
31
8f202758 32my $parser = Pod::Text->new or die "Cannot create parser\n";
f011ec7d 33my $n = 2;
34while (<DATA>) {
35 next until $_ eq "###\n";
36 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
37 while (<DATA>) {
38 last if $_ eq "###\n";
39 print TMP $_;
40 }
41 close TMP;
e2a52b10 42 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
43 $parser->parse_from_file ('tmp.pod', \*OUT);
44 close OUT;
f011ec7d 45 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
46 my $output;
47 {
48 local $/;
49 $output = <TMP>;
50 }
51 close TMP;
52 unlink ('tmp.pod', 'out.tmp');
53 my $expected = '';
54 while (<DATA>) {
55 last if $_ eq "###\n";
56 $expected .= $_;
57 }
58 if ($output eq $expected) {
59 print "ok $n\n";
0e4e3f6e 60 } elsif ($n == 4 && $Pod::Simple::VERSION < 3.06) {
61 print "ok $n # skip Pod::Simple S<> parsing bug\n";
f011ec7d 62 } else {
63 print "not ok $n\n";
64 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
65 }
66 $n++;
67}
68
69# Below the marker are bits of POD and corresponding expected text output.
70# This is used to test specific features or problems with Pod::Text. The
71# input and output are separated by lines containing only ###.
72
73__DATA__
74
75###
76=head1 PERIODS
77
78This C<.> should be quoted.
79###
80PERIODS
81 This "." should be quoted.
82
83###
b7ae008f 84
85###
86=head1 CE<lt>E<gt> WITH SPACES
87
88What does C<< this. >> end up looking like?
89###
90C<> WITH SPACES
91 What does "this." end up looking like?
92
93###
40dcca8a 94
95###
96=head1 Test of SE<lt>E<gt>
97
98This is some S< > whitespace.
99###
100Test of S<>
101 This is some whitespace.
3fe752ba 102
40dcca8a 103###
eccdc4d7 104
105###
106=head1 Test of =for
107
108=for comment
109This won't be seen.
110
111Yes.
112
113=for text
114This should be seen.
115
116=for TEXT As should this.
117
118=for man
119But this shouldn't.
120
121Some more text.
122###
123Test of =for
124 Yes.
125
126This should be seen.
127As should this.
128 Some more text.
129
130###
9d1cda07 131
132###
133=pod
134
135text
136
137 line1
138
139 line3
140###
141 text
142
143 line1
144
145 line3
146
147###