]> git.imager.perl.org - bse.git/blob - t/010-modules/050-format.t
75b937339b855f38bed3bb34e39aaeccf130857c
[bse.git] / t / 010-modules / 050-format.t
1 #!perl -w
2 use strict;
3 use Test::More tests => 142;
4
5 sub format_test($$$;$);
6 sub noformat_test($$$;$);
7
8 my $gotmodule = require_ok('DevHelp::Formatter');
9
10 ++$|;
11
12 SKIP: {
13   skip "couldn't load module", 63 unless $gotmodule;
14   format_test 'acronym[hello]', '<p><acronym>hello</acronym></p>', 'acronym';
15   format_test 'acronym[|hello]', '<p><acronym>hello</acronym></p>', 'acronym with empty title';
16   format_test 'acronym[foo|hello]', '<p><acronym title="foo">hello</acronym></p>', 'acronym with title';
17   format_test 'acronym[foo|bar|hello]', '<p><acronym class="bar" title="foo">hello</acronym></p>', 'acronym with class and title';
18   format_test 'bdo[ltr|hello]', '<p><bdo dir="ltr">hello</bdo></p>', 'bdo with dir';
19   format_test 'code[hello]', '<p><code>hello</code></p>', 'code';
20   format_test 'code[|hello]', '<p><code>hello</code></p>', 'code empty class';
21   format_test 'code[foo|hello]', '<p><code class="foo">hello</code></p>', 'code with class';
22   format_test 'code[var[x]="1"]', '<p><code><var>x</var>=&quot;1&quot;</code></p>', 'code with var';
23   format_test 'cite[hello]', '<p><cite>hello</cite></p>', 'cite';
24   format_test 'cite[|hello]', '<p><cite>hello</cite></p>', 'cite with empty title';
25   format_test 'cite[foo|hello]', '<p><cite title="foo">hello</cite></p>', 'cite with title';
26   format_test 'cite[foo|bar|hello]', '<p><cite class="bar" title="foo">hello</cite></p>', 'cite with class and title';
27   format_test 'small[hello]', '<p><small>hello</small></p>', 'small';
28   format_test 'small[|hello]', '<p><small>hello</small></p>', 'small empty class';
29   format_test 'small[foo|hello]', '<p><small class="foo">hello</small></p>', 'small with class';
30   format_test 'large[hello]', '<p><large>hello</large></p>', 'large';
31   format_test 'large[|hello]', '<p><large>hello</large></p>', 'large empty class';
32   format_test 'large[foo|hello]', '<p><large class="foo">hello</large></p>', 'large with class';
33   format_test 'mark[hello]', '<p><mark>hello</mark></p>', 'mark';
34   format_test 'mark[|hello]', '<p><mark>hello</mark></p>', 'mark empty class';
35   format_test 'mark[foo|hello]', '<p><mark class="foo">hello</mark></p>', 'mark with class';
36   format_test 'link[foo|hello]', '<p><a href="foo">hello</a></p>', 'anchor';
37   format_test 'poplink[foo|hello]', '<p><a href="foo" target="_blank">hello</a></p>', 'anchor with popup';
38   format_test <<IN, <<OUT, 'blockquote', 'both';
39 blockquote[hello]
40
41 blockquote[
42
43 hello]
44 IN
45 <blockquote>hello</blockquote>
46 <blockquote>
47 <p>hello</p>
48 </blockquote>
49 OUT
50   format_test <<IN, <<OUT, 'blockquote with empty class', 'both';
51 blockquote[|hello]
52
53 blockquote[|
54
55 hello
56
57 ]
58 IN
59 <blockquote>hello</blockquote>
60 <blockquote>
61 <p>hello</p>
62 </blockquote>
63 OUT
64   format_test <<IN, <<OUT, 'blockquote with class', 'both';
65 blockquote[foo|hello]
66
67 blockquote[foo|hello
68 world]
69
70 blockquote[foo|
71 hello
72 world]
73 IN
74 <blockquote class="foo">hello</blockquote>
75 <blockquote class="foo">hello<br />
76 world</blockquote>
77 <blockquote class="foo">
78 <p>hello<br />
79 world</p>
80 </blockquote>
81 OUT
82   format_test <<IN, <<OUT, 'article', 'both';
83 article[hello]
84
85 article[
86
87 hello]
88 IN
89 <article>hello</article>
90 <article>
91 <p>hello</p>
92 </article>
93 OUT
94   format_test <<IN, <<OUT, 'article with empty class', 'both';
95 article[|hello]
96
97 article[|
98
99 hello
100
101 ]
102 IN
103 <article>hello</article>
104 <article>
105 <p>hello</p>
106 </article>
107 OUT
108   format_test <<IN, <<OUT, 'article with id and class', 'both';
109 article[#id foo|hello]
110
111 article[#id foo|
112
113 hello]
114 IN
115 <article id="id" class="foo">hello</article>
116 <article id="id" class="foo">
117 <p>hello</p>
118 </article>
119 OUT
120   format_test <<IN, <<OUT, 'section', 'both';
121 section[
122 hello
123 ]
124 IN
125 <section>
126 <p>hello</p>
127 </section>
128 OUT
129   format_test <<IN, <<OUT, 'section with empty class', 'both';
130 section[|
131 hello]
132 IN
133 <section>
134 <p>hello</p>
135 </section>
136 OUT
137   format_test <<IN, <<OUT, 'section with id and class', 'both';
138 section[#id foo|hello
139
140 ]
141 IN
142 <section id="id" class="foo">
143 <p>hello</p>
144 </section>
145 OUT
146   format_test <<IN, <<OUT, 'header', 'both';
147 header[
148
149 hello]
150 IN
151 <header>
152 <p>hello</p>
153 </header>
154 OUT
155   format_test <<IN, <<OUT, 'header with empty class', 'both';
156 header[|hello
157
158 ]
159 IN
160 <header>
161 <p>hello</p>
162 </header>
163 OUT
164   format_test <<IN, <<OUT, 'header with id and class', 'both';
165 header[#id foo|
166 hello
167 ]
168 IN
169 <header id="id" class="foo">
170 <p>hello</p>
171 </header>
172 OUT
173   format_test <<IN, <<OUT, 'footer', 'both';
174 footer[hello
175 world]
176 IN
177 <footer>hello<br />
178 world</footer>
179 OUT
180   format_test <<IN, <<OUT, 'footer with empty class', 'both';
181 footer[|
182
183 hello
184
185 ]
186 IN
187 <footer>
188 <p>hello</p>
189 </footer>
190 OUT
191   format_test <<IN, <<OUT, 'footer with id and class', 'both';
192 footer[#id foo|hello
193
194 ]
195 IN
196 <footer id="id" class="foo">
197 <p>hello</p>
198 </footer>
199 OUT
200   format_test <<IN, <<OUT, 'aside', 'both';
201 aside[hello]
202 IN
203 <aside>hello</aside>
204 OUT
205   format_test <<IN, <<OUT, 'aside with empty class', 'both';
206 aside[|hello]
207 IN
208 <aside>hello</aside>
209 OUT
210   format_test <<IN, <<OUT, 'aside with id and class', 'both';
211 aside[#id foo|hello]
212 IN
213 <aside id="id" class="foo">hello</aside>
214 OUT
215   format_test <<IN, <<OUT, 'nav', 'both';
216 nav[hello]
217 IN
218 <nav>hello</nav>
219 OUT
220   format_test <<IN, <<OUT, 'nav with empty class', 'both';
221 nav[|
222
223 hello
224
225 ]
226 IN
227 <nav>
228 <p>hello</p>
229 </nav>
230 OUT
231   format_test <<IN, <<OUT, 'nav with id and class', 'both';
232 nav[#id foo|hello]
233 IN
234 <nav id="id" class="foo">hello</nav>
235 OUT
236   format_test <<IN, <<OUT, 'figure', 'both';
237 figure[hello]
238 IN
239 <figure>hello</figure>
240 OUT
241   format_test <<IN, <<OUT, 'figure with empty class', 'both';
242 figure[|hello]
243 IN
244 <figure>hello</figure>
245 OUT
246   format_test <<IN, <<OUT, 'figure with id and class', 'both';
247 figure[#id foo|hello]
248 IN
249 <figure id="id" class="foo">hello</figure>
250 OUT
251   format_test <<IN, <<OUT, 'figcaption', 'both';
252 figcaption[hello]
253 IN
254 <figcaption>hello</figcaption>
255 OUT
256   format_test <<IN, <<OUT, 'figcaption with empty class', 'both';
257 figcaption[|hello]
258 IN
259 <figcaption>hello</figcaption>
260 OUT
261   format_test <<IN, <<OUT, 'figcaption with id and class', 'both';
262 figcaption[#id foo|hello]
263 IN
264 <figcaption id="id" class="foo">hello</figcaption>
265 OUT
266   format_test <<IN, <<OUT, 'strong over paras', 'both';
267 strong[foo|hello
268
269 foo]
270 IN
271 <p><strong class="foo">hello</strong></p>
272 <p><strong class="foo">foo</strong></p>
273 OUT
274   format_test <<IN, <<OUT, 'blockquote list h1 var', 'both';
275 blockquote[
276 ** one
277 ** two
278 h1[quux]var[hello
279 there]
280
281 foo]
282 IN
283 <blockquote>
284 <ul><li>one</li><li>two</li></ul>
285 <h1>quux</h1>
286 <p><var>hello<br />
287 there</var></p>
288 <p>foo</p>
289 </blockquote>
290 OUT
291   format_test <<IN, <<OUT, 'address class h1 abbr over paras', 'both';
292 address[foo|h1[bar
293
294 quux]abbr[my abbr|hello]
295
296 class[foo|b[bold|E=MCsup[2]]]
297
298 foo]
299 IN
300 <address class="foo">
301 <h1>bar</h1>
302 <h1>quux</h1>
303 <p><abbr title="my abbr">hello</abbr></p>
304 <p class="foo"><b class="bold">E=MC<sup>2</sup></b></p>
305 <p>foo</p>
306 </address>
307 OUT
308   format_test <<IN, <<OUT, 'div blockquote h1 class over paras', 'both';
309 div[quux|blockquote[foo|h1[bar]
310 b[hello]
311 class[foo|b[bold|E=MCsup[2
312
313 kbd[xxx|super]]]]
314
315 foo]]
316 IN
317 <div class="quux">
318 <blockquote class="foo">
319 <h1>bar</h1>
320 <p><b>hello</b><br />
321 <span class="foo"><b class="bold">E=MC<sup>2</sup></b></span></p>
322 <p class="foo"><b class="bold"><sup><kbd class="xxx">super</kbd></sup></b></p>
323 <p>foo</p>
324 </blockquote>
325 </div>
326 OUT
327   format_test <<IN, <<OUT, 'bold', 'both';
328 b[hello]
329 IN
330 <p><b>hello</b></p>
331 OUT
332   format_test 'i[hello]', '<p><i>hello</i></p>', 'italic';
333   format_test 'b[i[hello]]', '<p><b><i>hello</i></b></p>', 'bold/italic';
334   format_test <<IN, <<OUT, 'bold over lines', 'both';
335 b[hello
336 foo]
337 IN
338 <p><b>hello<br />
339 foo</b></p>
340 OUT
341   format_test <<IN, <<OUT, 'bold over paras', 'both';
342 b[hello
343
344 foo]
345 IN
346 <p><b>hello</b></p>
347 <p><b>foo</b></p>
348 OUT
349   format_test <<IN, <<OUT, 'combo over paras', 'both';
350 i[b[hello
351
352 foo
353
354 bar]]
355 IN
356 <p><i><b>hello</b></i></p>
357 <p><i><b>foo</b></i></p>
358 <p><i><b>bar</b></i></p>
359 OUT
360   format_test <<IN, <<OUT, 'link', 'both';
361 link[http://foo/|bar
362
363 quux]
364 IN
365 <a href="http://foo/">
366 <p>bar</p>
367 <p>quux</p>
368 </a>
369 OUT
370   format_test 'tt[hello]', '<p><tt>hello</tt></p>', 'tt';
371   format_test 'font[-1|text]', '<p><font size="-1">text</font></p>', 'fontsize';
372   format_test 'fontcolor[-1|black|text]', '<p><font size="-1" color="black">text</font></p>', 'fontsizecolor';
373   format_test 'anchor[somename]', '<p><a name="somename"></a></p>', 'anchor';
374   format_test <<IN, <<OUT, 'pre', 'both';
375
376
377 pre[hello there
378 Joe]
379 IN
380 <pre>hello there
381 Joe</pre>
382 OUT
383   format_test <<IN, <<OUT, 'pre with bold', 'both';
384 pre[b[hello there
385
386 Joe]]
387 IN
388 <pre><b>hello there</b>
389
390 <b>Joe</b></pre>
391 OUT
392   format_test <<IN, <<OUT, 'html', 'both';
393 html[<object foo="bar" />]
394 IN
395 <object foo="bar" />
396 OUT
397
398   format_test 'embed[foo]', '', 'embed1';
399   format_test 'embed[foo,bar]', '', 'embed2';
400   format_test 'embed[foo,bar,quux]', '', 'embed3';
401   format_test 'h1[|text]', '<h1>text</h1>', 'h1';
402   format_test 'h1[someclass|text]', '<h1 class="someclass">text</h1>', 'h1class';
403   format_test 'h6[|te>xt]', '<h6>te&gt;xt</h6>', 'h6';
404   format_test 'h1[|foo]h2[|bar]', "<h1>foo</h1>\n<h2>bar</h2>", 'h1h2';
405   format_test 'h1[|foo]texth2[|bar]', 
406     "<h1>foo</h1>\n<p>text</p>\n<h2>bar</h2>", 'h1texth2';
407   format_test <<IN, <<OUT, 'align', 'both';
408 align[left|some text]
409 IN
410 <div align="left">
411 <p>some text</p>
412 </div>
413 OUT
414   format_test 'hr[]', '<hr />', 'hr0';
415   format_test 'hr[80%]', '<hr width="80%" />', 'hr1';
416   format_test 'hr[80%|10]', '<hr width="80%" size="10" />', 'hr2';
417   format_test <<'IN', <<'OUT', 'hr with other text', 'both';
418 testhr[]test
419 hr[80%]
420 test
421 IN
422 <p>test</p>
423 <hr />
424 <p>test</p>
425 <hr width="80%" />
426 <p>test</p>
427 OUT
428   format_test <<IN, <<OUT, 'table1', 'both';
429 table[80%
430 bgcolor="black"|quux|blarg
431 |hello|there
432 ]
433 IN
434 <table width="80%"><tr bgcolor="black"><td>quux</td><td>blarg</td></tr><tr><td>hello</td><td>there</td></tr></table>
435 OUT
436   format_test <<IN, <<OUT, 'table2', 'both';
437 table[80%|#808080|2|2|Arial
438 bgcolor="black"|quux|blarg
439 |hello|there
440 ]
441 IN
442 <table width="80%" bgcolor="#808080" cellpadding="2"><tr bgcolor="black"><td><font size="2" face="Arial">quux</font></td><td><font size="2" face="Arial">blarg</font></td></tr><tr><td><font size="2" face="Arial">hello</font></td><td><font size="2" face="Arial">there</font></td></tr></table>
443 OUT
444   format_test <<IN, <<OUT, 'table3', 'both';
445 table[80%|foo]
446 IN
447 <table width="80%"><tr><td>foo</td></tr></table>
448 OUT
449   format_test <<IN, <<OUT, 'ol1', 'both';
450 ## one
451 ## two
452 IN
453 <ol><li>one</li><li>two</li></ol>
454 OUT
455   format_test <<IN, <<OUT, 'ol2', 'both';
456 ## one
457
458 ## two
459 IN
460 <ol><li><p>one</p></li><li>two</li></ol>
461 OUT
462   format_test <<IN, <<OUT, 'ol1 alpha', 'both';
463 %% one
464 %% two
465 IN
466 <ol type="a"><li>one</li><li>two</li></ol>
467 OUT
468   format_test <<IN, <<OUT, 'ol2 alpha', 'both';
469 %% one
470
471 %% two
472 IN
473 <ol type="a"><li><p>one</p></li><li>two</li></ol>
474 OUT
475   format_test <<IN, <<OUT, 'ul1', 'both';
476 ** one
477 ** two
478 IN
479 <ul><li>one</li><li>two</li></ul>
480 OUT
481   format_test <<IN, <<OUT, 'ul2', 'both';
482 ** one
483
484 ** two
485 IN
486 <ul><li><p>one</p></li><li>two</li></ul>
487 OUT
488
489   format_test <<IN, <<OUT, 'ul indented', 'both';
490   ** one
491 **two
492 IN
493 <ul><li>one</li><li>two</li></ul>
494 OUT
495
496   format_test <<IN, <<OUT, "don't ul at end of line", 'both';
497 this shouldn't be a bullet ** some text
498
499 ** this should be a bullet
500 ** so should this
501 IN
502 <p>this shouldn't be a bullet ** some text</p>
503 <ul><li>this should be a bullet</li><li>so should this</li></ul>
504 OUT
505
506   format_test <<IN, <<OUT, 'mixed', 'both';
507 ** joe
508 ** bob
509 ## one
510 ## two
511 IN
512 <ul><li>joe</li><li>bob</li></ul><ol><li>one</li><li>two</li></ol>
513 OUT
514
515   format_test <<IN, <<OUT, 'spaces between', 'both';
516 ** joe
517  
518 ** bob
519
520 ** jane
521 IN
522 <ul><li><p>joe</p></li><li><p>bob</p></li><li>jane</li></ul>
523 OUT
524
525   format_test 'indent[text]', '<ul>text</ul>', 'indent';
526   format_test 'center[text]', '<center>text</center>', 'center';
527   format_test 'hrcolor[80|10|#FF0000]', <<OUT, 'hrcolor', 'out';
528 <table width="80" height="10" border="0" bgcolor="#FF0000" cellpadding="0" cellspacing="0"><tr><td><img src="/images/trans_pixel.gif" width="1" height="1" alt="" /></td></tr></table>
529 OUT
530   format_test 'image[foo]', '<p></p>', 'image';
531
532   format_test 'class[xxx|yyy]', '<p class="xxx">yyy</p>', 'class';
533   format_test "class[xxx|yy\n\nzz]", <<EOS, 'class2', 'out';
534 <p class="xxx">yy</p>
535 <p class="xxx">zz</p>
536 EOS
537   format_test 'div[someclass|h1[|foo]barh2[|quux]]', <<EOS, 'divblock', 'out';
538 <div class="someclass">
539 <h1>foo</h1>
540 <p>bar</p>
541 <h2>quux</h2>
542 </div>
543 EOS
544
545   format_test "h1[#foo|test]", q!<h1 id="foo">test</h1>!, 'h1#id';
546   format_test "h1[#foo bar|test]", q!<h1 id="foo" class="bar">test</h1>!, 'h1#id class';
547   format_test "h1[#foo bar quux|test]", q!<h1 id="foo" class="bar quux">test</h1>!, 'h1#id class class';
548   format_test "h1[text-align: center;|test]", q!<h1 style="text-align: center;">test</h1>!, 'h1 styled';
549   format_test "h1[#foo text-align: center;|test]", q!<h1 id="foo" style="text-align: center;">test</h1>!, 'h1 styled, id';
550
551   format_test "div[text-align: center;|test\n\ntest2]", <<EOS, 'div styled', 'out';
552 <div style="text-align: center;">
553 <p>test</p>
554 <p>test2</p>
555 </div>
556 EOS
557
558   format_test "div[#foo|test\n\ntest2]", <<EOS, 'div #id', 'out';
559 <div id="foo">
560 <p>test</p>
561 <p>test2</p>
562 </div>
563 EOS
564
565   format_test "abc comment[foo] def", "<p>abc  def</p>", "comment";
566   format_test <<IN, <<OUT, 'link over paras following an hr', 'both';
567 hr[100%]
568
569 link[#foo|hello
570
571 world]
572
573 link[#foo|
574 hello
575
576 world]
577 IN
578 <hr width="100%" />
579 <a href="#foo">
580 <p>hello</p>
581 <p>world</p>
582 </a>
583 <a href="#foo">
584 <p>hello</p>
585 <p>world</p>
586 </a>
587 OUT
588
589 format_test <<IN, <<OUT, 'link over div block containing paras', 'both';
590 link[#foo|
591
592 div[#id class background-color: red;|
593
594 hello
595
596 world
597
598 ]
599 ]
600 IN
601 <a href="#foo">
602 <div id="id" style="background-color: red;" class="class">
603 <p>hello</p>
604 <p>world</p>
605 </div>
606 </a>
607 OUT
608
609 format_test <<IN, <<OUT, 'poplink over div block containing paras', 'both';
610
611 poplink[http://www.example.com/|
612
613 div[#id class background-color: red;|
614
615 hello
616
617 world
618
619 ]
620 ]
621 IN
622 <a href="http://www.example.com/" target="_blank">
623 <div id="id" style="background-color: red;" class="class">
624 <p>hello</p>
625 <p>world</p>
626 </div>
627 </a>
628 OUT
629
630 format_test <<IN, <<OUT, 'link over complex nested block structure', 'both';
631
632 link[http://www.example.com/|
633
634 section[#id class background-color: red;|
635
636 header[h1[headline
637
638 more]
639
640 ]
641
642 article[foo|
643
644 b[bar|hello
645
646 i[world
647
648 today]]
649
650 div[i[tomorrow]
651
652 class[quux|yesterday]]
653
654 ]
655
656 footer[#id|footer]
657
658 ]
659 ]
660 IN
661 <a href="http://www.example.com/">
662 <section id="id" style="background-color: red;" class="class">
663 <header>
664 <h1>headline</h1>
665 <h1>more</h1>
666 </header>
667 <article class="foo">
668 <p><b class="bar">hello</b></p>
669 <p><b class="bar"><i>world</i></b></p>
670 <p><b class="bar"><i>today</i></b></p>
671 <div>
672 <p><i>tomorrow</i></p>
673 <p class="quux">yesterday</p>
674 </div>
675 </article>
676 <footer id="id">footer</footer>
677 </section>
678 </a>
679 OUT
680
681 format_test <<IN, <<OUT, 'list inside a block', 'both';
682 div[#id|
683 ** item
684 ** item
685 ]
686 IN
687 <div id="id">
688 <ul><li>item</li><li>item</li></ul>
689 </div>
690 OUT
691
692   # remove_format() tests
693   noformat_test 'image[foo]', '', 'image';
694   noformat_test 'code[something [bar]]', 'something [bar]', 'nested []';
695
696   noformat_test "abc comment[foo] def", "abc  def", "comment";
697
698   noformat_test 'class[foo|image[bar]]', '', 'class with image content';
699   noformat_test 'abbr[image[bar]]', '', 'abbr[] with image content';
700   noformat_test 'abbr[foo|image[bar]]', '', 'abbr[x|x] with image content';
701   noformat_test 'abbr[|image[bar]]', '', 'abbr[|x] with image content';
702   noformat_test 'strong[image[bar]]', '', 'strong[x] with image content';
703   noformat_test 'strong[|image[bar]]', '', 'strong[|x] with image content';
704   noformat_test 'strong[foo|image[bar]]', '', 'strong[x|x] with image content';
705
706   noformat_test 'div[foo|image[bar]]', '', 'div[x|x] with image content';
707   noformat_test 'comment[image[bar]]', '', 'comment[image[xx]] with image content';
708   noformat_test 'h1[foo|image[bar]]', '', 'h1[x|x] with image content';
709   noformat_test 'h1[|image[bar]]', '', 'h1[|x] with image content';
710   noformat_test 'h1[image[bar]]', '', 'h1[x] with image content';
711   
712   noformat_test 'poplink[xxx|image[bar]]', '', 'poplink[x|x] with image content';
713   noformat_test 'poplink[image[bar]]', '', 'poplink[x] with image content';
714   noformat_test 'link[xxx|image[bar]]', '', 'link[x|x] with image content';
715   noformat_test 'link[image[bar]]', '', 'link[x] with image content';
716   noformat_test 'align[xxx|image[bar]]', '', 'align[x|x] with image content';
717   noformat_test 'font[xxx|image[bar]]', '', 'font[x|x] with image content';
718   noformat_test 'hr[xxx|image[bar]]', '', 'hr[x|x] with image content';
719   noformat_test 'anchor[image[bar]]', '', 'anchor[x] with image content';
720   noformat_test '**image[bar]', '', '** list with image content';
721   noformat_test '%%image[bar]', '', '%% list with image content';
722   noformat_test '##image[bar]', '', '## list with image content';
723 }
724
725 sub format_test ($$$;$) {
726   my ($in, $out, $desc, $stripnl) = @_;
727
728   $stripnl ||= 'none';
729   $in =~ s/\n$// if $stripnl eq 'in' || $stripnl eq 'both';
730   $out =~ s/\n$// if $stripnl eq 'out' || $stripnl eq 'both';
731
732   my $formatter = DevHelp::Formatter->new;
733
734   my $result = $formatter->format($in);
735
736   is($result, $out, $desc);
737 }
738
739 sub noformat_test($$$;$) {
740   my ($in, $out, $desc, $stripnl) = @_;
741
742   $stripnl ||= 'none';
743   $in =~ s/\n$// if $stripnl eq 'in' || $stripnl eq 'both';
744   $out =~ s/\n$// if $stripnl eq 'out' || $stripnl eq 'both';
745
746   my $formatter = DevHelp::Formatter->new;
747
748   my $result = $formatter->remove_format($in);
749
750   is($result, $out, $desc);
751 }