Debian lenny version packages
[pkg-perl] / deb-src / libpod-simple-perl / libpod-simple-perl-3.07 / t / verbatim.t
1 # Testing verbatim sections
2 use strict;
3 use Test;
4 BEGIN { plan tests => 31 };
5
6 #use Pod::Simple::Debug (6);
7
8 ok 1;
9
10 use Pod::Simple::DumpAsXML;
11 use Pod::Simple::XMLOutStream;
12 print "# Pod::Simple version $Pod::Simple::VERSION\n";
13 sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
14
15 &ok( e "", "" );
16 &ok( e "\n", "", );
17
18
19
20
21 &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz" );
22 &ok( e "\n=pod\n\n foo bar baz", "\n=pod\n\n foo bar baz\n" );
23
24
25 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n"),
26   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz</Verbatim></Document>}
27 );
28 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n quux\n"),
29   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz\n quux</Verbatim></Document>}
30 );
31 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\nquux\n"),
32   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz\nquux</Verbatim></Document>}
33 );
34
35 print "# Contiguous verbatims...\n";
36 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n quux\n"),
37   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz\n\n quux</Verbatim></Document>}
38 );
39 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n quux\n"),
40   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz\n\n\n quux</Verbatim></Document>}
41 );
42
43 print "# Testing =cut...\n";
44 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n quux\n"),
45   qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz</Verbatim></Document>}
46 );
47
48
49 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
51 {
52 my $it =
53 qq{<Document><Verbatim\nxml:space="preserve"> foo bar baz</Verbatim><head1>Foo</head1><Verbatim\nxml:space="preserve"> quux\nquum</Verbatim></Document>}
54 ;
55
56
57 print "# Various \\n-(in)significance sanity checks...\n";
58
59 print "#  verbatim/cut/head/verbatim sanity zero...\n";
60
61 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=head1 Foo\n\n quux\nquum\n"), $it);
62 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it);
63 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it);
64
65 print "#  verbatim/cut/head/verbatim sanity one...\n";
66
67 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it);
68 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it);
69 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n=head1 Foo\n\n quux\nquum\n"), $it);
70
71 print "#  verbatim/cut/head/verbatim sanity two...\n";
72
73 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it);
74 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it);
75 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\n\nsome code here...\n\n=head1 Foo\n\n quux\nquum\n"), $it);
76
77 print "#  verbatim/cut/head/verbatim sanity three...\n";
78
79 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
80 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
81 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
82
83 print "#  verbatim/cut/head/verbatim sanity four...\n";
84
85 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
86 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
87 ok( Pod::Simple::XMLOutStream->_out("\n=pod\n\n foo bar baz\n\n\n\n\n\n=cut\n\nsome code here...\n\n\n=head1 Foo\n\n quux\nquum\n"), $it);
88
89 }
90
91 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92
93 print "# Testing tab expansion...\n";
94
95 &ok( e
96 q{=pod
97
98  here we go now
99 a
100  b
101   c
102    d
103     e
104      f
105       g
106        h
107         i
108          j
109           k
110            l
111             m
112              n
113               o
114                p
115                 q
116                  r
117                   s
118                    t
119                     u
120                      v
121                       w
122                        x
123                         y
124                          z
125 },
126 q{=pod
127
128  here we go now
129 a
130  b
131   c
132    d
133     e
134      f
135       g
136        h
137         i
138          j
139           k
140            l
141             m
142              n
143               o
144                p
145                 q
146                  r
147                   s
148                    t
149                     u
150                      v
151                       w
152                        x
153                         y
154                          z
155 },
156 );
157
158 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159
160 &ok( e
161 q{=pod
162
163  here we go now
164 a
165 .b
166 . c
167 .  d
168 .   e
169 .    f
170 .     g
171 .      h
172 .       i
173 .        j
174 .         k
175 .          l
176 .           m
177 .            n
178 .             o
179 .              p
180 .               q
181 .                r
182 .                 s
183 .                  t
184 .                   u
185 .                    v
186 .                     w
187 .                      x
188 .                       y
189 .                        z
190 },
191 q{=pod
192
193  here we go now
194 a
195 .b
196 . c
197 .  d
198 .   e
199 .    f
200 .     g
201 .      h
202 .       i
203 .        j
204 .         k
205 .          l
206 .           m
207 .            n
208 .             o
209 .              p
210 .               q
211 .                r
212 .                 s
213 .                  t
214 .                   u
215 .                    v
216 .                     w
217 .                      x
218 .                       y
219 .                        z
220 },
221 );
222
223 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
225 &ok( e
226 q{=pod
227
228  here we go now
229 a
230 .b
231 ..c
232 .. d
233 ..  e
234 ..   f
235 ..    g
236 ..     h
237 ..      i
238 ..       j
239 ..        k
240 ..         l
241 ..          m
242 ..           n
243 ..            o
244 ..             p
245 ..              q
246 ..               r
247 ..                s
248 ..                 t
249 ..                  u
250 ..                   v
251 ..                    w
252 ..                     x
253 ..                      y
254 ..                       z
255 },
256 q{=pod
257
258  here we go now
259 a
260 .b
261 ..c
262 .. d
263 ..  e
264 ..   f
265 ..    g
266 ..     h
267 ..      i
268 ..       j
269 ..        k
270 ..         l
271 ..          m
272 ..           n
273 ..            o
274 ..             p
275 ..              q
276 ..               r
277 ..                s
278 ..                 t
279 ..                  u
280 ..                   v
281 ..                    w
282 ..                     x
283 ..                      y
284 ..                       z
285 },
286 );
287
288
289 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290
291 &ok( e
292 q{=pod
293
294  here we go now
295 a
296 .b
297 ..c
298 .. d
299 ..  e
300 ..   f
301 ..    g
302 ..     h
303 ..      i
304 ..      .j
305 ..      . k
306 ..      .  l
307 ..      .   m
308 ..      .    n
309 ..      .     o
310 ..      .      p
311 ..      .       q
312 ..      .        r
313 ..      .         s
314 ..      .          t
315 ..      .           u
316 ..      .            v
317 ..      .             w
318 ..      .              x
319 ..      .               y
320 ..      .                z
321 },
322 q{=pod
323
324  here we go now
325 a
326 .b
327 ..c
328 .. d
329 ..  e
330 ..   f
331 ..    g
332 ..     h
333 ..      i
334 ..      .j
335 ..      . k
336 ..      .  l
337 ..      .   m
338 ..      .    n
339 ..      .     o
340 ..      .      p
341 ..      .       q
342 ..      .        r
343 ..      .         s
344 ..      .          t
345 ..      .           u
346 ..      .            v
347 ..      .             w
348 ..      .              x
349 ..      .               y
350 ..      .                z
351 },
352 );
353
354 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355
356 # TODO: long-line splitting?
357
358
359 print "# Wrapping up... one for the road...\n";
360 ok 1;
361 print "# --- Done with ", __FILE__, " --- \n";
362
363