diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-09-26 16:47:48 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-09-26 17:51:17 +0100 |
commit | f4e6b6923ba5d1ff0ca1ddc96955a42cab82e1e4 (patch) | |
tree | f1c5d409b315a50c738e6db0e182631c46c3fa4e /cpan/podlators/t | |
parent | 832db5b145e835174f45afb2c497b046dc1fc2ac (diff) | |
download | perl-f4e6b6923ba5d1ff0ca1ddc96955a42cab82e1e4.tar.gz |
Move podlators from ext/ to cpan/
Diffstat (limited to 'cpan/podlators/t')
-rw-r--r-- | cpan/podlators/t/basic.cap | 268 | ||||
-rw-r--r-- | cpan/podlators/t/basic.clr | 269 | ||||
-rw-r--r-- | cpan/podlators/t/basic.man | 321 | ||||
-rw-r--r-- | cpan/podlators/t/basic.ovr | 269 | ||||
-rw-r--r-- | cpan/podlators/t/basic.pod | 383 | ||||
-rw-r--r-- | cpan/podlators/t/basic.t | 127 | ||||
-rw-r--r-- | cpan/podlators/t/basic.txt | 269 | ||||
-rw-r--r-- | cpan/podlators/t/color.t | 88 | ||||
-rw-r--r-- | cpan/podlators/t/filehandle.t | 121 | ||||
-rw-r--r-- | cpan/podlators/t/man-options.t | 175 | ||||
-rw-r--r-- | cpan/podlators/t/man-utf8.t | 141 | ||||
-rw-r--r-- | cpan/podlators/t/man.t | 484 | ||||
-rw-r--r-- | cpan/podlators/t/parselink.t | 132 | ||||
-rw-r--r-- | cpan/podlators/t/pod-parser.t | 102 | ||||
-rw-r--r-- | cpan/podlators/t/pod-spelling.t | 76 | ||||
-rw-r--r-- | cpan/podlators/t/pod.t | 11 | ||||
-rw-r--r-- | cpan/podlators/t/termcap.t | 85 | ||||
-rw-r--r-- | cpan/podlators/t/text-encoding.t | 142 | ||||
-rw-r--r-- | cpan/podlators/t/text-options.t | 271 | ||||
-rw-r--r-- | cpan/podlators/t/text-utf8.t | 129 | ||||
-rw-r--r-- | cpan/podlators/t/text.t | 147 |
21 files changed, 4010 insertions, 0 deletions
diff --git a/cpan/podlators/t/basic.cap b/cpan/podlators/t/basic.cap new file mode 100644 index 0000000000..20fc1e561c --- /dev/null +++ b/cpan/podlators/t/basic.cap @@ -0,0 +1,268 @@ +[1mNAME[m + basic.pod - Test of various basic POD features in translators. + +[1mHEADINGS[m + Try a few different levels of headings, with embedded formatting codes and + other interesting bits. + +[1mThis "is" a "level 1" heading[m + [1m``Level'' "2 [4mheading[m[m + Level 3 [1mheading [4mwith "weird stuff "" (double quote)"[m[m + Level "4 "heading" + Now try again with [1mintermixed[m text. + +[1mThis "is" a "level 1" heading[m + Text. + + [1m``Level'' 2 [4mheading[m[m + Text. + + Level 3 [1mheading [4mwith "weird stuff"[m[m + Text. + + Level "4 "heading" + Text. + +[1mLINKS[m + These are all taken from the Pod::Parser tests. + + Try out [4mLOTS[m of different ways of specifying references: + + Reference the "section" in manpage + + Reference the "section" in "manpage" + + Reference the "section" in manpage + + Now try it using the new "|" stuff ... + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext| + + And then throw in a few new ones of my own. + + foo + + foo + + "bar" in foo + + "baz boo" in foo + + "bar" + + "baz boo" + + "baz boo" + + "baz boo" in foo bar + + "boo var baz" + + "bar baz" + + "boo", "bar", and "baz" + + foobar + + Testing [4mitalics[m + + "[4mItalic[m text" in foo + + "Section "with" [4m[1mother[m markup[m" in foo|bar + + Nested <http://www.perl.org/> + +[1mOVER AND ITEMS[m + Taken from Pod::Parser tests, this is a test to ensure that multiline + =item paragraphs get indented appropriately. + + This is a test. + + There should be whitespace now before this line. + + Taken from Pod::Parser tests, this is a test to ensure the nested =item + paragraphs get indented appropriately. + + 1 First section. + + a this is item a + + b this is item b + + 2 Second section. + + a this is item a + + b this is item b + + c + d This is item c & d. + + Now some additional weirdness of our own. Make sure that multiple tags for + one paragraph are properly compacted. + + "foo" + [1mbar[m + "baz" + There shouldn't be any spaces between any of these item tags; this + idiom is used in perlfunc. + + Some longer item text + Just to make sure that we test paragraphs where the item text doesn't + fit in the margin of the paragraph (and make sure that this paragraph + fills a few lines). + + Let's also make it multiple paragraphs to be sure that works. + + Test use of =over without =item as a block "quote" or block paragraph. + + This should be indented four spaces but otherwise formatted the same + as any other regular text paragraph. Make sure it's long enough to see + the results of the formatting..... + + Now try the same thing nested, and make sure that the indentation is reset + back properly. + + This paragraph should be doubly indented. + + This paragraph should only be singly indented. + + * This is an item in the middle of a block-quote, which should be + allowed. + + * We're also testing tagless item commands. + + Should be back to the single level of indentation. + + Should be back to regular indentation. + + Now also check the transformation of * into real bullets for man pages. + + * An item. We're also testing using =over without a number, and making + sure that item text wraps properly. + + * Another item. + + and now test the numbering of item blocks. + + 1. First item. + + 2. Second item. + +[1mFORMATTING CODES[m + Another test taken from Pod::Parser. + + This is a test to see if I can do not only $self and "method()", but also + "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" without + resorting to escape sequences. If I want to refer to the right-shift + operator I can do something like "$x >> 3" or even "$y >> 5". + + Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}". + And I also want to make sure that newlines work like this "$self->{FOOBAR} + >> 3 and [$b => $a]->[$a <=> $b]" + + Of course I should still be able to do all this [4mwith[m escape sequences too: + "$self->method()" and "$self->{FIELDNAME}" and "{FOO=>BAR}". + + Dont forget "$self->method()->{FIELDNAME} = {FOO=>BAR}". + + And make sure that 0 works too! + + Now, if I use << or >> as my delimiters, then I have to use whitespace. So + things like "<$self-"method()>> and "<$self-"{FIELDNAME}>> wont end up + doing what you might expect since the first > will still terminate the + first < seen. + + Lets make sure these work for empty ones too, like "" and ">>" (just to be + obnoxious) + + The statement: "This is dog kind's [4mfinest[m hour!" is a parody of a + quotation from Winston Churchill. + + The following tests are added to those: + + Make sure that a few other odd [4mthings[m still work. This should be a + vertical bar: |. Here's a test of a few more special escapes that have to + be supported: + + & An ampersand. + + ' An apostrophe. + + < A less-than sign. + + > A greater-than sign. + + " A double quotation mark. + + / A forward slash. + + Try to get this bit of text over towards the edge so + |that all of this text inside S<> won't| be wrapped. Also test the + |same thing with non-breaking spaces.| + + There is a soft hyphen in hyphen at hy-phen. + + This is a test of an index entry. + +[1mVERBATIM[m + Throw in a few verbatim paragraphs. + + use Term::ANSIColor; + print color 'bold blue'; + print "This text is bold blue.\n"; + print color 'reset'; + print "This text is normal.\n"; + print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print "This text is normal.\n"; + print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + + use Term::ANSIColor qw(uncolor); + print uncolor '01;31', "\n"; + + But this isn't verbatim (make sure it wraps properly), and the next + paragraph is again: + + use Term::ANSIColor qw(:constants); + print BOLD, BLUE, "This text is in bold blue.\n", RESET; + + use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; + + (Ugh, that's obnoxiously long.) Try different spacing: + + Starting with a tab. + Not + starting + with + a + tab. But this should still be verbatim. + As should this. + + This isn't. + + This is. And this: is an internal tab. It should be: + |--| <= lined up with that. + + (Tricky, but tabs should be expanded before the translator starts in on + the text since otherwise text with mixed tabs and spaces will get messed + up.) + + And now we test verbatim paragraphs right before a heading. Older + versions of Pod::Man generated two spaces between paragraphs like this + and the heading. (In order to properly test this, one may have to + visually inspect the nroff output when run on the generated *roff + text, unfortunately.) + +[1mCONCLUSION[m + That's all, folks! + diff --git a/cpan/podlators/t/basic.clr b/cpan/podlators/t/basic.clr new file mode 100644 index 0000000000..f98857187a --- /dev/null +++ b/cpan/podlators/t/basic.clr @@ -0,0 +1,269 @@ +[1mNAME[0m + basic.pod - Test of various basic POD features in translators. + +[1mHEADINGS[0m + Try a few different levels of headings, with embedded formatting codes + and other interesting bits. + +[1mThis "is" a "level 1" heading[0m + [1m``Level'' "2 [33mheading[0m[0m + Level 3 [1mheading [33mwith "weird [36mstuff "" (double quote)[0m"[0m[0m + Level "4 "heading" + Now try again with [1mintermixed[0m [36mtext[0m. + +[1mThis "is" a "level 1" heading[0m + Text. + + [1m``Level'' 2 [33mheading[0m[0m + Text. + + Level 3 [1mheading [33mwith "weird [36mstuff[0m"[0m[0m + Text. + + Level "4 "heading" + Text. + +[1mLINKS[0m + These are all taken from the Pod::Parser tests. + + Try out [33mLOTS[0m of different ways of specifying references: + + Reference the "section" in manpage + + Reference the "section" in "manpage" + + Reference the "section" in manpage + + Now try it using the new "|" stuff ... + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext| + + And then throw in a few new ones of my own. + + foo + + foo + + "bar" in foo + + "baz boo" in foo + + "bar" + + "baz boo" + + "baz boo" + + "baz boo" in foo bar + + "boo var baz" + + "bar baz" + + "boo", "bar", and "baz" + + foobar + + Testing [33mitalics[0m + + "[33mItalic[0m text" in foo + + "Section "with" [33m[1mother[0m markup[0m" in foo|bar + + Nested <http://www.perl.org/> + +[1mOVER AND ITEMS[0m + Taken from Pod::Parser tests, this is a test to ensure that multiline + =item paragraphs get indented appropriately. + + This is a test. + + There should be whitespace now before this line. + + Taken from Pod::Parser tests, this is a test to ensure the nested =item + paragraphs get indented appropriately. + + 1 First section. + + a this is item a + + b this is item b + + 2 Second section. + + a this is item a + + b this is item b + + c + d This is item c & d. + + Now some additional weirdness of our own. Make sure that multiple tags + for one paragraph are properly compacted. + + "foo" + [1mbar[0m + "baz" + There shouldn't be any spaces between any of these item tags; this + idiom is used in perlfunc. + + Some longer item text + Just to make sure that we test paragraphs where the item text + doesn't fit in the margin of the paragraph (and make sure that this + paragraph fills a few lines). + + Let's also make it multiple paragraphs to be sure that works. + + Test use of =over without =item as a block "quote" or block paragraph. + + This should be indented four spaces but otherwise formatted the same + as any other regular text paragraph. Make sure it's long enough to + see the results of the formatting..... + + Now try the same thing nested, and make sure that the indentation is + reset back properly. + + This paragraph should be doubly indented. + + This paragraph should only be singly indented. + + * This is an item in the middle of a block-quote, which should be + allowed. + + * We're also testing tagless item commands. + + Should be back to the single level of indentation. + + Should be back to regular indentation. + + Now also check the transformation of * into real bullets for man pages. + + * An item. We're also testing using =over without a number, and making + sure that item text wraps properly. + + * Another item. + + and now test the numbering of item blocks. + + 1. First item. + + 2. Second item. + +[1mFORMATTING CODES[0m + Another test taken from Pod::Parser. + + This is a test to see if I can do not only $self and "method()", but + also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" + without resorting to escape sequences. If I want to refer to the + right-shift operator I can do something like "$x >> 3" or even "$y >> + 5". + + Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}". + And I also want to make sure that newlines work like this + "$self->{FOOBAR} >> 3 and [$b => $a]->[$a <=> $b]" + + Of course I should still be able to do all this [33mwith[0m escape sequences + too: "$self->method()" and "$self->{FIELDNAME}" and "{FOO=>BAR}". + + Dont forget "$self->method()->{FIELDNAME} = {FOO=>BAR}". + + And make sure that 0 works too! + + Now, if I use << or >> as my delimiters, then I have to use whitespace. + So things like "<$self-"method()>> and "<$self-"{FIELDNAME}>> wont end + up doing what you might expect since the first > will still terminate + the first < seen. + + Lets make sure these work for empty ones too, like "" and ">>" (just to + be obnoxious) + + The statement: "This is dog kind's [33mfinest[0m hour!" is a parody of a + quotation from Winston Churchill. + + The following tests are added to those: + + Make sure that a few other odd [33mthings[0m still work. This should be a + vertical bar: |. Here's a test of a few more special escapes that have + to be supported: + + & An ampersand. + + ' An apostrophe. + + < A less-than sign. + + > A greater-than sign. + + " A double quotation mark. + + / A forward slash. + + Try to get this bit of text over towards the edge so + |that all of this text inside S<> won't| be wrapped. Also test the + |same thing with non-breaking spaces.| + + There is a soft hyphen in hyphen at hy-phen. + + This is a test of an index entry. + +[1mVERBATIM[0m + Throw in a few verbatim paragraphs. + + use Term::ANSIColor; + print color 'bold blue'; + print "This text is bold blue.\n"; + print color 'reset'; + print "This text is normal.\n"; + print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print "This text is normal.\n"; + print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + + use Term::ANSIColor qw(uncolor); + print uncolor '01;31', "\n"; + + But this isn't verbatim (make sure it wraps properly), and the next + paragraph is again: + + use Term::ANSIColor qw(:constants); + print BOLD, BLUE, "This text is in bold blue.\n", RESET; + + use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; + + (Ugh, that's obnoxiously long.) Try different spacing: + + Starting with a tab. + Not + starting + with + a + tab. But this should still be verbatim. + As should this. + + This isn't. + + This is. And this: is an internal tab. It should be: + |--| <= lined up with that. + + (Tricky, but tabs should be expanded before the translator starts in on + the text since otherwise text with mixed tabs and spaces will get messed + up.) + + And now we test verbatim paragraphs right before a heading. Older + versions of Pod::Man generated two spaces between paragraphs like this + and the heading. (In order to properly test this, one may have to + visually inspect the nroff output when run on the generated *roff + text, unfortunately.) + +[1mCONCLUSION[0m + That's all, folks! + diff --git a/cpan/podlators/t/basic.man b/cpan/podlators/t/basic.man new file mode 100644 index 0000000000..43874b6e87 --- /dev/null +++ b/cpan/podlators/t/basic.man @@ -0,0 +1,321 @@ +.SH "NAME" +basic.pod \- Test of various basic POD features in translators. +.SH "HEADINGS" +.IX Header "HEADINGS" +Try a few different levels of headings, with embedded formatting codes and +other interesting bits. +.ie n .SH "This ""is"" a ""level 1"" heading" +.el .SH "This \f(CWis\fP a ``level 1'' heading" +.IX Header "This is a level 1 heading" +.SS "``Level'' ""2 \fIheading\fP" +.IX Subsection "``Level'' ""2 heading" +\fILevel 3 \f(BIheading \f(BIwith \f(CB\*(C`weird \f(CBstuff "" (double quote)\f(CB\*(C'\f(BI\f(BI\fI\fR +.IX Subsection "Level 3 heading with weird stuff """" (double quote)" +.PP +Level "4 \f(CW\*(C`heading\*(C'\fR +.IX Subsection "Level ""4 heading" +.PP +Now try again with \fBintermixed\fR \fItext\fR. +.ie n .SH "This ""is"" a ""level 1"" heading" +.el .SH "This \f(CWis\fP a ``level 1'' heading" +.IX Header "This is a level 1 heading" +Text. +.SS "``Level'' 2 \fIheading\fP" +.IX Subsection "``Level'' 2 heading" +Text. +.PP +\fILevel 3 \f(BIheading \f(BIwith \f(CB\*(C`weird \f(CBstuff\f(CB\*(C'\f(BI\f(BI\fI\fR +.IX Subsection "Level 3 heading with weird stuff" +.PP +Text. +.PP +Level "4 \f(CW\*(C`heading\*(C'\fR +.IX Subsection "Level ""4 heading" +.PP +Text. +.SH "LINKS" +.IX Header "LINKS" +These are all taken from the Pod::Parser tests. +.PP +Try out \fI\s-1LOTS\s0\fR of different ways of specifying references: +.PP +Reference the \*(L"section\*(R" in manpage +.PP +Reference the \*(L"section\*(R" in \*(L"manpage\*(R" +.PP +Reference the \*(L"section\*(R" in manpage +.PP +Now try it using the new \*(L"|\*(R" stuff ... +.PP +Reference the thistext| +.PP +Reference the thistext | +.PP +Reference the thistext| +.PP +Reference the thistext | +.PP +Reference the thistext| +.PP +Reference the thistext| +.PP +And then throw in a few new ones of my own. +.PP +foo +.PP +foo +.PP +\&\*(L"bar\*(R" in foo +.PP +\&\*(L"baz boo\*(R" in foo +.PP +\&\*(L"bar\*(R" +.PP +\&\*(L"baz boo\*(R" +.PP +\&\*(L"baz boo\*(R" +.PP +\&\*(L"baz boo\*(R" in foo bar +.PP +\&\*(L"boo var baz\*(R" +.PP +\&\*(L"bar baz\*(R" +.PP +\&\*(L"boo\*(R", \*(L"bar\*(R", and \*(L"baz\*(R" +.PP +foobar +.PP +Testing \fIitalics\fR +.PP +"\fIItalic\fR text" in foo +.PP +"Section \f(CW\*(C`with\*(C'\fR \fI\f(BIother\fI markup\fR" in foo|bar +.PP +Nested <http://www.perl.org/> +.SH "OVER AND ITEMS" +.IX Header "OVER AND ITEMS" +Taken from Pod::Parser tests, this is a test to ensure that multiline +=item paragraphs get indented appropriately. +.IP "This is a test." 4 +.IX Item "This is a test." +.PP +There should be whitespace now before this line. +.PP +Taken from Pod::Parser tests, this is a test to ensure the nested =item +paragraphs get indented appropriately. +.IP "1." 2 +First section. +.RS 2 +.IP "a" 2 +.IX Item "a" +this is item a +.IP "b" 2 +.IX Item "b" +this is item b +.RE +.RS 2 +.RE +.IP "2." 2 +Second section. +.RS 2 +.IP "a" 2 +.IX Item "a" +this is item a +.IP "b" 2 +.IX Item "b" +this is item b +.IP "c" 2 +.IX Item "c" +.PD 0 +.IP "d" 2 +.IX Item "d" +.PD +This is item c & d. +.RE +.RS 2 +.RE +.PP +Now some additional weirdness of our own. Make sure that multiple tags +for one paragraph are properly compacted. +.ie n .IP """foo""" 4 +.el .IP "``foo''" 4 +.IX Item "foo" +.PD 0 +.IP "\fBbar\fR" 4 +.IX Item "bar" +.ie n .IP """baz""" 4 +.el .IP "\f(CWbaz\fR" 4 +.IX Item "baz" +.PD +There shouldn't be any spaces between any of these item tags; this idiom +is used in perlfunc. +.IP "Some longer item text" 4 +.IX Item "Some longer item text" +Just to make sure that we test paragraphs where the item text doesn't fit +in the margin of the paragraph (and make sure that this paragraph fills a +few lines). +.Sp +Let's also make it multiple paragraphs to be sure that works. +.PP +Test use of =over without =item as a block \*(L"quote\*(R" or block paragraph. +.Sp +.RS 4 +This should be indented four spaces but otherwise formatted the same as +any other regular text paragraph. Make sure it's long enough to see the +results of the formatting..... +.RE +.PP +Now try the same thing nested, and make sure that the indentation is reset +back properly. +.RS 4 +.Sp +.RS 4 +This paragraph should be doubly indented. +.RE +.RE +.RS 4 +.Sp +This paragraph should only be singly indented. +.IP "\(bu" 4 +This is an item in the middle of a block-quote, which should be allowed. +.IP "\(bu" 4 +We're also testing tagless item commands. +.RE +.RS 4 +.Sp +Should be back to the single level of indentation. +.RE +.PP +Should be back to regular indentation. +.PP +Now also check the transformation of * into real bullets for man pages. +.IP "\(bu" 4 +An item. We're also testing using =over without a number, and making sure +that item text wraps properly. +.IP "\(bu" 4 +Another item. +.PP +and now test the numbering of item blocks. +.IP "1." 4 +First item. +.IP "2." 4 +Second item. +.SH "FORMATTING CODES" +.IX Header "FORMATTING CODES" +Another test taken from Pod::Parser. +.PP +This is a test to see if I can do not only \f(CW$self\fR and \f(CW\*(C`method()\*(C'\fR, but +also \f(CW\*(C`$self\->method()\*(C'\fR and \f(CW\*(C`$self\->{FIELDNAME}\*(C'\fR and +\&\f(CW\*(C`$Foo <=> $Bar\*(C'\fR without resorting to escape sequences. If +I want to refer to the right-shift operator I can do something +like \f(CW\*(C`$x >> 3\*(C'\fR or even \f(CW\*(C`$y >> 5\*(C'\fR. +.PP +Now for the grand finale of \f(CW\*(C`$self\->method()\->{FIELDNAME} = {FOO=>BAR}\*(C'\fR. +And I also want to make sure that newlines work like this +\&\f(CW\*(C`$self\->{FOOBAR} >> 3 and [$b => $a]\->[$a <=> $b]\*(C'\fR +.PP +Of course I should still be able to do all this \fIwith\fR escape sequences +too: \f(CW\*(C`$self\->method()\*(C'\fR and \f(CW\*(C`$self\->{FIELDNAME}\*(C'\fR and +\&\f(CW\*(C`{FOO=>BAR}\*(C'\fR. +.PP +Dont forget \f(CW\*(C`$self\->method()\->{FIELDNAME} = {FOO=>BAR}\*(C'\fR. +.PP +And make sure that \f(CW0\fR works too! +.PP +Now, if I use << or >> as my delimiters, then I have to use whitespace. +So things like \f(CW\*(C`<$self\-\*(C'\fR\fImethod()\fR>> and \f(CW\*(C`<$self\-\*(C'\fR{\s-1FIELDNAME\s0}>> wont end +up doing what you might expect since the first > will still terminate +the first < seen. +.PP +Lets make sure these work for empty ones too, like \f(CW\*(C`\*(C'\fR and \f(CW\*(C`>>\*(C'\fR +(just to be obnoxious) +.PP +The statement: \f(CW\*(C`This is dog kind\*(Aqs \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a +quotation from Winston Churchill. +.PP +The following tests are added to those: +.PP +Make sure that a few other odd \fIthings\fR still work. This should be +a vertical bar: |. Here's a test of a few more special escapes +that have to be supported: +.IP "&" 3 +An ampersand. +.IP "'" 3 +An apostrophe. +.IP "<" 3 +A less-than sign. +.IP ">" 3 +A greater-than sign. +.IP """" 3 +A double quotation mark. +.IP "/" 3 +A forward slash. +.PP +Try to get this bit of text over towards the edge so |that\ all\ of\ this\ text\ inside\ S<>\ won't| be wrapped. Also test the +|same\ thing\ with\ non-breaking\ spaces.| +.PP +There is a soft hy\%phen in hyphen at hy-phen. +.PP +This is a test of an index entry. +.IX Xref "index entry" +.SH "VERBATIM" +.IX Header "VERBATIM" +Throw in a few verbatim paragraphs. +.PP +.Vb 8 +\& use Term::ANSIColor; +\& print color \*(Aqbold blue\*(Aq; +\& print "This text is bold blue.\en"; +\& print color \*(Aqreset\*(Aq; +\& print "This text is normal.\en"; +\& print colored ("Yellow on magenta.\en", \*(Aqyellow on_magenta\*(Aq); +\& print "This text is normal.\en"; +\& print colored [\*(Aqyellow on_magenta\*(Aq], "Yellow on magenta.\en"; +\& +\& use Term::ANSIColor qw(uncolor); +\& print uncolor \*(Aq01;31\*(Aq, "\en"; +.Ve +.PP +But this isn't verbatim (make sure it wraps properly), and the next +paragraph is again: +.PP +.Vb 2 +\& use Term::ANSIColor qw(:constants); +\& print BOLD, BLUE, "This text is in bold blue.\en", RESET; +\& +\& use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\en"; print "This text is normal.\en"; +.Ve +.PP +(Ugh, that's obnoxiously long.) Try different spacing: +.PP +.Vb 7 +\& Starting with a tab. +\&Not +\&starting +\&with +\&a +\&tab. But this should still be verbatim. +\& As should this. +.Ve +.PP +This isn't. +.PP +.Vb 2 +\& This is. And this: is an internal tab. It should be: +\& |\-\-| <= lined up with that. +.Ve +.PP +(Tricky, but tabs should be expanded before the translator starts in on +the text since otherwise text with mixed tabs and spaces will get messed +up.) +.PP +.Vb 5 +\& And now we test verbatim paragraphs right before a heading. Older +\& versions of Pod::Man generated two spaces between paragraphs like this +\& and the heading. (In order to properly test this, one may have to +\& visually inspect the nroff output when run on the generated *roff +\& text, unfortunately.) +.Ve +.SH "CONCLUSION" +.IX Header "CONCLUSION" +That's all, folks! diff --git a/cpan/podlators/t/basic.ovr b/cpan/podlators/t/basic.ovr new file mode 100644 index 0000000000..bb124a0bd4 --- /dev/null +++ b/cpan/podlators/t/basic.ovr @@ -0,0 +1,269 @@ +NNAAMMEE + basic.pod - Test of various basic POD features in translators. + +HHEEAADDIINNGGSS + Try a few different levels of headings, with embedded formatting codes + and other interesting bits. + +TThhiiss ""iiss"" aa ""lleevveell 11"" hheeaaddiinngg + ````LLeevveell'''' ""22 hheeaaddiinngg + _L_e_v_e_l_ _3_ _h_e_a_d_i_n_g_ _w_i_t_h_ _"_w_e_i_r_d_ _s_t_u_f_f_ _"_"_ _(_d_o_u_b_l_e_ _q_u_o_t_e_)_" + _L_e_v_e_l_ _"_4_ _"_h_e_a_d_i_n_g_" + Now try again with iinntteerrmmiixxeedd _t_e_x_t. + +TThhiiss ""iiss"" aa ""lleevveell 11"" hheeaaddiinngg + Text. + + ````LLeevveell'''' 22 hheeaaddiinngg + Text. + + _L_e_v_e_l_ _3_ _h_e_a_d_i_n_g_ _w_i_t_h_ _"_w_e_i_r_d_ _s_t_u_f_f_" + Text. + + _L_e_v_e_l_ _"_4_ _"_h_e_a_d_i_n_g_" + Text. + +LLIINNKKSS + These are all taken from the Pod::Parser tests. + + Try out _L_O_T_S of different ways of specifying references: + + Reference the "section" in manpage + + Reference the "section" in "manpage" + + Reference the "section" in manpage + + Now try it using the new "|" stuff ... + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext| + + And then throw in a few new ones of my own. + + foo + + foo + + "bar" in foo + + "baz boo" in foo + + "bar" + + "baz boo" + + "baz boo" + + "baz boo" in foo bar + + "boo var baz" + + "bar baz" + + "boo", "bar", and "baz" + + foobar + + Testing _i_t_a_l_i_c_s + + "_I_t_a_l_i_c text" in foo + + "Section "with" _o_t_h_e_r_ _m_a_r_k_u_p" in foo|bar + + Nested <http://www.perl.org/> + +OOVVEERR AANNDD IITTEEMMSS + Taken from Pod::Parser tests, this is a test to ensure that multiline + =item paragraphs get indented appropriately. + + This is a test. + + There should be whitespace now before this line. + + Taken from Pod::Parser tests, this is a test to ensure the nested =item + paragraphs get indented appropriately. + + 1 First section. + + a this is item a + + b this is item b + + 2 Second section. + + a this is item a + + b this is item b + + c + d This is item c & d. + + Now some additional weirdness of our own. Make sure that multiple tags + for one paragraph are properly compacted. + + "foo" + bbaarr + "baz" + There shouldn't be any spaces between any of these item tags; this + idiom is used in perlfunc. + + Some longer item text + Just to make sure that we test paragraphs where the item text + doesn't fit in the margin of the paragraph (and make sure that this + paragraph fills a few lines). + + Let's also make it multiple paragraphs to be sure that works. + + Test use of =over without =item as a block "quote" or block paragraph. + + This should be indented four spaces but otherwise formatted the same + as any other regular text paragraph. Make sure it's long enough to + see the results of the formatting..... + + Now try the same thing nested, and make sure that the indentation is + reset back properly. + + This paragraph should be doubly indented. + + This paragraph should only be singly indented. + + * This is an item in the middle of a block-quote, which should be + allowed. + + * We're also testing tagless item commands. + + Should be back to the single level of indentation. + + Should be back to regular indentation. + + Now also check the transformation of * into real bullets for man pages. + + * An item. We're also testing using =over without a number, and making + sure that item text wraps properly. + + * Another item. + + and now test the numbering of item blocks. + + 1. First item. + + 2. Second item. + +FFOORRMMAATTTTIINNGG CCOODDEESS + Another test taken from Pod::Parser. + + This is a test to see if I can do not only $self and "method()", but + also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" + without resorting to escape sequences. If I want to refer to the + right-shift operator I can do something like "$x >> 3" or even "$y >> + 5". + + Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}". + And I also want to make sure that newlines work like this + "$self->{FOOBAR} >> 3 and [$b => $a]->[$a <=> $b]" + + Of course I should still be able to do all this _w_i_t_h escape sequences + too: "$self->method()" and "$self->{FIELDNAME}" and "{FOO=>BAR}". + + Dont forget "$self->method()->{FIELDNAME} = {FOO=>BAR}". + + And make sure that 0 works too! + + Now, if I use << or >> as my delimiters, then I have to use whitespace. + So things like "<$self-"method()>> and "<$self-"{FIELDNAME}>> wont end + up doing what you might expect since the first > will still terminate + the first < seen. + + Lets make sure these work for empty ones too, like "" and ">>" (just to + be obnoxious) + + The statement: "This is dog kind's _f_i_n_e_s_t hour!" is a parody of a + quotation from Winston Churchill. + + The following tests are added to those: + + Make sure that a few other odd _t_h_i_n_g_s still work. This should be a + vertical bar: |. Here's a test of a few more special escapes that have + to be supported: + + & An ampersand. + + ' An apostrophe. + + < A less-than sign. + + > A greater-than sign. + + " A double quotation mark. + + / A forward slash. + + Try to get this bit of text over towards the edge so + |that all of this text inside S<> won't| be wrapped. Also test the + |same thing with non-breaking spaces.| + + There is a soft hyphen in hyphen at hy-phen. + + This is a test of an index entry. + +VVEERRBBAATTIIMM + Throw in a few verbatim paragraphs. + + use Term::ANSIColor; + print color 'bold blue'; + print "This text is bold blue.\n"; + print color 'reset'; + print "This text is normal.\n"; + print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print "This text is normal.\n"; + print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + + use Term::ANSIColor qw(uncolor); + print uncolor '01;31', "\n"; + + But this isn't verbatim (make sure it wraps properly), and the next + paragraph is again: + + use Term::ANSIColor qw(:constants); + print BOLD, BLUE, "This text is in bold blue.\n", RESET; + + use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; + + (Ugh, that's obnoxiously long.) Try different spacing: + + Starting with a tab. + Not + starting + with + a + tab. But this should still be verbatim. + As should this. + + This isn't. + + This is. And this: is an internal tab. It should be: + |--| <= lined up with that. + + (Tricky, but tabs should be expanded before the translator starts in on + the text since otherwise text with mixed tabs and spaces will get messed + up.) + + And now we test verbatim paragraphs right before a heading. Older + versions of Pod::Man generated two spaces between paragraphs like this + and the heading. (In order to properly test this, one may have to + visually inspect the nroff output when run on the generated *roff + text, unfortunately.) + +CCOONNCCLLUUSSIIOONN + That's all, folks! + diff --git a/cpan/podlators/t/basic.pod b/cpan/podlators/t/basic.pod new file mode 100644 index 0000000000..949b3a8886 --- /dev/null +++ b/cpan/podlators/t/basic.pod @@ -0,0 +1,383 @@ +=head1 NAME + +basic.pod - Test of various basic POD features in translators. + +=head1 HEADINGS + +Try a few different levels of headings, with embedded formatting codes and +other interesting bits. + +=head1 This C<is> a "level 1" heading + +=head2 ``Level'' "2 I<heading> + +=head3 Level 3 B<heading I<with C<weird F<stuff "" (double quote)>>>> + +=head4 Level "4 C<heading> + +Now try again with B<intermixed> F<text>. + +=head1 This C<is> a "level 1" heading + +Text. + +=head2 ``Level'' 2 I<heading> + +Text. + +=head3 Level 3 B<heading I<with C<weird F<stuff>>>> + +Text. + +=head4 Level "4 C<heading> + +Text. + +=head1 LINKS + +These are all taken from the Pod::Parser tests. + +Try out I<LOTS> of different ways of specifying references: + +Reference the L<manpage/section> + +Reference the L<"manpage"/section> + +Reference the L<manpage/"section"> + +Now try it using the new "|" stuff ... + +Reference the L<thistext|manpage/section>| + +Reference the L<thistext | manpage / section>| + +Reference the L<thistext| manpage/ section>| + +Reference the L<thistext |manpage /section>| + +Reference the L<thistext|manpage/"section">| + +Reference the L<thistext| +manpage/ +section>| + +And then throw in a few new ones of my own. + +L<foo> + +L<foo|bar> + +L<foo/bar> + +L<foo/"baz boo"> + +L</bar> + +L</"baz boo"> + +L</baz boo> + +L<foo bar/baz boo> + +L<"boo var baz"> + +L<bar baz> + +L</boo>, L</bar>, and L</baz> + +L<fooZ<>bar> + +L<Testing I<italics>|foo/bar> + +L<foo/I<Italic> text> + +L<fooE<verbar>barZ<>/Section C<with> I<B<other> markup>> + +L<Nested L<http://www.perl.org/>|fooE<sol>bar> + +=head1 OVER AND ITEMS + +Taken from Pod::Parser tests, this is a test to ensure that multiline +=item paragraphs get indented appropriately. + +=over 4 + +=item This +is +a +test. + +=back + +There should be whitespace now before this line. + +Taken from Pod::Parser tests, this is a test to ensure the nested =item +paragraphs get indented appropriately. + +=over 2 + +=item 1 + +First section. + +=over 2 + +=item a + +this is item a + +=item b + +this is item b + +=back + +=item 2 + +Second section. + +=over 2 + +=item a + +this is item a + +=item b + +this is item b + +=item c + +=item d + +This is item c & d. + +=back + +=back + +Now some additional weirdness of our own. Make sure that multiple tags +for one paragraph are properly compacted. + +=over 4 + +=item "foo" + +=item B<bar> + +=item C<baz> + +There shouldn't be any spaces between any of these item tags; this idiom +is used in perlfunc. + +=item Some longer item text + +Just to make sure that we test paragraphs where the item text doesn't fit +in the margin of the paragraph (and make sure that this paragraph fills a +few lines). + +Let's also make it multiple paragraphs to be sure that works. + +=back + +Test use of =over without =item as a block "quote" or block paragraph. + +=over 4 + +This should be indented four spaces but otherwise formatted the same as +any other regular text paragraph. Make sure it's long enough to see the +results of the formatting..... + +=back + +Now try the same thing nested, and make sure that the indentation is reset +back properly. + +=over 4 + +=over 4 + +This paragraph should be doubly indented. + +=back + +This paragraph should only be singly indented. + +=over 4 + +=item + +This is an item in the middle of a block-quote, which should be allowed. + +=item + +We're also testing tagless item commands. + +=back + +Should be back to the single level of indentation. + +=back + +Should be back to regular indentation. + +Now also check the transformation of * into real bullets for man pages. + +=over + +=item * + +An item. We're also testing using =over without a number, and making sure +that item text wraps properly. + +=item * + +Another item. + +=back + +and now test the numbering of item blocks. + +=over 4 + +=item 1. + +First item. + +=item 2. + +Second item. + +=back + +=head1 FORMATTING CODES + +Another test taken from Pod::Parser. + +This is a test to see if I can do not only C<$self> and C<method()>, but +also C<< $self->method() >> and C<< $self->{FIELDNAME} >> and +C<< $Foo <=> $Bar >> without resorting to escape sequences. If +I want to refer to the right-shift operator I can do something +like C<<< $x >> 3 >>> or even C<<<< $y >> 5 >>>>. + +Now for the grand finale of C<< $self->method()->{FIELDNAME} = {FOO=>BAR} >>. +And I also want to make sure that newlines work like this +C<<< +$self->{FOOBAR} >> 3 and [$b => $a]->[$a <=> $b] +>>> + +Of course I should still be able to do all this I<with> escape sequences +too: C<$self-E<gt>method()> and C<$self-E<gt>{FIELDNAME}> and +C<{FOO=E<gt>BAR}>. + +Dont forget C<$self-E<gt>method()-E<gt>{FIELDNAME} = {FOO=E<gt>BAR}>. + +And make sure that C<0> works too! + +Now, if I use << or >> as my delimiters, then I have to use whitespace. +So things like C<<$self->method()>> and C<<$self->{FIELDNAME}>> wont end +up doing what you might expect since the first > will still terminate +the first < seen. + +Lets make sure these work for empty ones too, like C<< >> and C<< >> >> +(just to be obnoxious) + +The statement: C<This is dog kind's I<finest> hour!> is a parody of a +quotation from Winston Churchill. + +The following tests are added to those: + +Make sure that a few othZ<>er odd I<Z<>things> still work. This should be +a vertical bar: E<verbar>. Here's a test of a few more special escapes +that have to be supported: + +=over 3 + +=item E<amp> + +An ampersand. + +=item E<apos> + +An apostrophe. + +=item E<lt> + +A less-than sign. + +=item E<gt> + +A greater-than sign. + +=item E<quot> + +A double quotation mark. + +=item E<sol> + +A forward slash. + +=back + +Try to get this bit of text over towards the edge so S<|that all of this +text inside SE<lt>E<gt> won't|> be wrapped. Also test the +|sameE<nbsp>thingE<nbsp>withE<nbsp>non-breakingS< spaces>.| + +There is a soft hyE<shy>phen in hyphen at hy-phen. + +This is a test of an X<index entry>index entry. + +=head1 VERBATIM + +Throw in a few verbatim paragraphs. + + use Term::ANSIColor; + print color 'bold blue'; + print "This text is bold blue.\n"; + print color 'reset'; + print "This text is normal.\n"; + print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print "This text is normal.\n"; + print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + + use Term::ANSIColor qw(uncolor); + print uncolor '01;31', "\n"; + +But this isn't verbatim (make sure it wraps properly), and the next +paragraph is again: + + use Term::ANSIColor qw(:constants); + print BOLD, BLUE, "This text is in bold blue.\n", RESET; + + use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; + +(Ugh, that's obnoxiously long.) Try different spacing: + + Starting with a tab. +Not +starting +with +a +tab. But this should still be verbatim. + As should this. + +This isn't. + + This is. And this: is an internal tab. It should be: + |--| <= lined up with that. + +(Tricky, but tabs should be expanded before the translator starts in on +the text since otherwise text with mixed tabs and spaces will get messed +up.) + + And now we test verbatim paragraphs right before a heading. Older + versions of Pod::Man generated two spaces between paragraphs like this + and the heading. (In order to properly test this, one may have to + visually inspect the nroff output when run on the generated *roff + text, unfortunately.) + +=head1 CONCLUSION + +That's all, folks! + +=cut diff --git a/cpan/podlators/t/basic.t b/cpan/podlators/t/basic.t new file mode 100644 index 0000000000..603d108574 --- /dev/null +++ b/cpan/podlators/t/basic.t @@ -0,0 +1,127 @@ +#!/usr/bin/perl -w +# +# basic.t -- Basic tests for podlators. +# +# Copyright 2001, 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..11\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; +use Pod::Text; +use Pod::Text::Overstrike; +use Pod::Text::Termcap; + +# Find the path to the test source files. This requires some fiddling when +# these tests are run as part of Perl core. +sub source_path { + my $file = shift; + if ($ENV{PERL_CORE}) { + require File::Spec; + my $updir = File::Spec->updir; + my $dir = File::Spec->catdir ($updir, 'lib', 'Pod', 't'); + return File::Spec->catfile ($dir, $file); + } else { + return $file; + } +} + +$loaded = 1; +print "ok 1\n"; + +# Hard-code a few values to try to get reproducible results. +$ENV{COLUMNS} = 80; +$ENV{TERM} = 'xterm'; +$ENV{TERMCAP} = 'xterm:co=80:do=^J:md=\E[1m:us=\E[4m:me=\E[m'; + +# Map of translators to file extensions to find the formatted output to +# compare against. +my %translators = ('Pod::Man' => 'man', + 'Pod::Text' => 'txt', + 'Pod::Text::Color' => 'clr', + 'Pod::Text::Overstrike' => 'ovr', + 'Pod::Text::Termcap' => 'cap'); + +# Set default options to match those of pod2man and pod2text. +%options = (sentence => 0); + +my $n = 2; +for (sort keys %translators) { + if ($_ eq 'Pod::Text::Color') { + eval { require Term::ANSIColor }; + if ($@) { + print "ok $n # skip\n"; + $n++; + print "ok $n # skip\n"; + $n++; + next; + } + require Pod::Text::Color; + } + my $parser = $_->new (%options); + print (($parser && ref ($parser) eq $_) ? "ok $n\n" : "not ok $n\n"); + $n++; + + # For Pod::Man, strip out the autogenerated header up to the .TH title + # line. That means that we don't check those things; oh well. The header + # changes with each version change or touch of the input file. + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file (source_path ('basic.pod'), \*OUT); + close OUT; + if ($_ eq 'Pod::Man') { + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + open (OUTPUT, "> out.$translators{$_}") + or die "Cannot create out.$translators{$_}: $!\n"; + local $_; + while (<TMP>) { last if /^\.nh/ } + print OUTPUT while <TMP>; + close OUTPUT; + close TMP; + unlink 'out.tmp'; + } else { + rename ('out.tmp', "out.$translators{$_}") + or die "Cannot rename out.tmp: $!\n"; + } + { + local $/; + open (MASTER, source_path ("basic.$translators{$_}")) + or die "Cannot open basic.$translators{$_}: $!\n"; + open (OUTPUT, "out.$translators{$_}") + or die "Cannot open out.$translators{$_}: $!\n"; + my $master = <MASTER>; + my $output = <OUTPUT>; + close MASTER; + close OUTPUT; + + # OS/390 is EBCDIC, which uses a different character for ESC + # apparently. Try to convert so that the test still works. + if ($^O eq 'os390' && $_ eq 'Pod::Text::Termcap') { + $output =~ tr/\033/\047/; + } + + if ($master eq $output) { + print "ok $n\n"; + unlink "out.$translators{$_}"; + } else { + print "not ok $n\n"; + print "# Non-matching output left in out.$translators{$_}\n"; + } + } + $n++; +} diff --git a/cpan/podlators/t/basic.txt b/cpan/podlators/t/basic.txt new file mode 100644 index 0000000000..986e98a1cd --- /dev/null +++ b/cpan/podlators/t/basic.txt @@ -0,0 +1,269 @@ +NAME + basic.pod - Test of various basic POD features in translators. + +HEADINGS + Try a few different levels of headings, with embedded formatting codes + and other interesting bits. + +This "is" a "level 1" heading + ``Level'' "2 *heading* + Level 3 heading *with "weird stuff "" (double quote)"* + Level "4 "heading" + Now try again with intermixed text. + +This "is" a "level 1" heading + Text. + + ``Level'' 2 *heading* + Text. + + Level 3 heading *with "weird stuff"* + Text. + + Level "4 "heading" + Text. + +LINKS + These are all taken from the Pod::Parser tests. + + Try out *LOTS* of different ways of specifying references: + + Reference the "section" in manpage + + Reference the "section" in "manpage" + + Reference the "section" in manpage + + Now try it using the new "|" stuff ... + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext | + + Reference the thistext| + + Reference the thistext| + + And then throw in a few new ones of my own. + + foo + + foo + + "bar" in foo + + "baz boo" in foo + + "bar" + + "baz boo" + + "baz boo" + + "baz boo" in foo bar + + "boo var baz" + + "bar baz" + + "boo", "bar", and "baz" + + foobar + + Testing *italics* + + "*Italic* text" in foo + + "Section "with" *other markup*" in foo|bar + + Nested <http://www.perl.org/> + +OVER AND ITEMS + Taken from Pod::Parser tests, this is a test to ensure that multiline + =item paragraphs get indented appropriately. + + This is a test. + + There should be whitespace now before this line. + + Taken from Pod::Parser tests, this is a test to ensure the nested =item + paragraphs get indented appropriately. + + 1 First section. + + a this is item a + + b this is item b + + 2 Second section. + + a this is item a + + b this is item b + + c + d This is item c & d. + + Now some additional weirdness of our own. Make sure that multiple tags + for one paragraph are properly compacted. + + "foo" + bar + "baz" + There shouldn't be any spaces between any of these item tags; this + idiom is used in perlfunc. + + Some longer item text + Just to make sure that we test paragraphs where the item text + doesn't fit in the margin of the paragraph (and make sure that this + paragraph fills a few lines). + + Let's also make it multiple paragraphs to be sure that works. + + Test use of =over without =item as a block "quote" or block paragraph. + + This should be indented four spaces but otherwise formatted the same + as any other regular text paragraph. Make sure it's long enough to + see the results of the formatting..... + + Now try the same thing nested, and make sure that the indentation is + reset back properly. + + This paragraph should be doubly indented. + + This paragraph should only be singly indented. + + * This is an item in the middle of a block-quote, which should be + allowed. + + * We're also testing tagless item commands. + + Should be back to the single level of indentation. + + Should be back to regular indentation. + + Now also check the transformation of * into real bullets for man pages. + + * An item. We're also testing using =over without a number, and making + sure that item text wraps properly. + + * Another item. + + and now test the numbering of item blocks. + + 1. First item. + + 2. Second item. + +FORMATTING CODES + Another test taken from Pod::Parser. + + This is a test to see if I can do not only $self and "method()", but + also "$self->method()" and "$self->{FIELDNAME}" and "$Foo <=> $Bar" + without resorting to escape sequences. If I want to refer to the + right-shift operator I can do something like "$x >> 3" or even "$y >> + 5". + + Now for the grand finale of "$self->method()->{FIELDNAME} = {FOO=>BAR}". + And I also want to make sure that newlines work like this + "$self->{FOOBAR} >> 3 and [$b => $a]->[$a <=> $b]" + + Of course I should still be able to do all this *with* escape sequences + too: "$self->method()" and "$self->{FIELDNAME}" and "{FOO=>BAR}". + + Dont forget "$self->method()->{FIELDNAME} = {FOO=>BAR}". + + And make sure that 0 works too! + + Now, if I use << or >> as my delimiters, then I have to use whitespace. + So things like "<$self-"method()>> and "<$self-"{FIELDNAME}>> wont end + up doing what you might expect since the first > will still terminate + the first < seen. + + Lets make sure these work for empty ones too, like "" and ">>" (just to + be obnoxious) + + The statement: "This is dog kind's *finest* hour!" is a parody of a + quotation from Winston Churchill. + + The following tests are added to those: + + Make sure that a few other odd *things* still work. This should be a + vertical bar: |. Here's a test of a few more special escapes that have + to be supported: + + & An ampersand. + + ' An apostrophe. + + < A less-than sign. + + > A greater-than sign. + + " A double quotation mark. + + / A forward slash. + + Try to get this bit of text over towards the edge so + |that all of this text inside S<> won't| be wrapped. Also test the + |same thing with non-breaking spaces.| + + There is a soft hyphen in hyphen at hy-phen. + + This is a test of an index entry. + +VERBATIM + Throw in a few verbatim paragraphs. + + use Term::ANSIColor; + print color 'bold blue'; + print "This text is bold blue.\n"; + print color 'reset'; + print "This text is normal.\n"; + print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print "This text is normal.\n"; + print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + + use Term::ANSIColor qw(uncolor); + print uncolor '01;31', "\n"; + + But this isn't verbatim (make sure it wraps properly), and the next + paragraph is again: + + use Term::ANSIColor qw(:constants); + print BOLD, BLUE, "This text is in bold blue.\n", RESET; + + use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n"; print "This text is normal.\n"; + + (Ugh, that's obnoxiously long.) Try different spacing: + + Starting with a tab. + Not + starting + with + a + tab. But this should still be verbatim. + As should this. + + This isn't. + + This is. And this: is an internal tab. It should be: + |--| <= lined up with that. + + (Tricky, but tabs should be expanded before the translator starts in on + the text since otherwise text with mixed tabs and spaces will get messed + up.) + + And now we test verbatim paragraphs right before a heading. Older + versions of Pod::Man generated two spaces between paragraphs like this + and the heading. (In order to properly test this, one may have to + visually inspect the nroff output when run on the generated *roff + text, unfortunately.) + +CONCLUSION + That's all, folks! + diff --git a/cpan/podlators/t/color.t b/cpan/podlators/t/color.t new file mode 100644 index 0000000000..2f1668f88e --- /dev/null +++ b/cpan/podlators/t/color.t @@ -0,0 +1,88 @@ +#!/usr/bin/perl -w +# +# color.t -- Additional specialized tests for Pod::Text::Color. +# +# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..2\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +eval { require Term::ANSIColor }; +if ($@) { + for (1..2) { + print "ok $_ # skip\n"; + } + $loaded = 1; + exit; +} +require Pod::Text::Color; + +$loaded = 1; +print "ok 1\n"; + +my $parser = Pod::Text::Color->new or die "Cannot create parser\n"; +my $n = 2; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected output. This is +# used to test specific features or problems with Pod::Text::Termcap. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 WRAPPING + +B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>. +### +[1mWRAPPING[0m + [1m[33mDo[0m[0m [33m[1mnot[0m[0m [1m[33minclude[0m[0m [1m[33mformatting codes when[0m[0m [1m[33mwrapping[0m[0m. + +### diff --git a/cpan/podlators/t/filehandle.t b/cpan/podlators/t/filehandle.t new file mode 100644 index 0000000000..a53884d50d --- /dev/null +++ b/cpan/podlators/t/filehandle.t @@ -0,0 +1,121 @@ +#!/usr/bin/perl -w +# +# filehandle.t -- Test the parse_from_filehandle interface. +# +# Copyright 2006 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..3\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; +use Pod::Text; + +$loaded = 1; +print "ok 1\n"; + +my $man = Pod::Man->new or die "Cannot create parser\n"; +my $text = Pod::Text->new or die "Cannot create parser\n"; +my $n = 2; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $man->parse_from_filehandle (\*IN, \*OUT); + close IN; + close OUT; + open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + while (<OUT>) { last if /^\.nh/ } + my $output; + { + local $/; + $output = <OUT>; + } + close OUT; + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; + open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $text->parse_from_filehandle (\*IN, \*OUT); + close IN; + close OUT; + open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + { + local $/; + $output = <OUT>; + } + close OUT; + unlink ('tmp.pod', 'out.tmp'); + $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD, corresponding expected nroff output, and +# corresponding expected text output. The input and output are separated by +# lines containing only ###. + +__DATA__ + +### +=head1 NAME + +gcc - GNU project C and C++ compiler + +=head1 C++ NOTES + +Other mentions of C++. +### +.SH "NAME" +gcc \- GNU project C and C++ compiler +.SH "\*(C+ NOTES" +.IX Header " NOTES" +Other mentions of \*(C+. +### +NAME + gcc - GNU project C and C++ compiler + +C++ NOTES + Other mentions of C++. + +### diff --git a/cpan/podlators/t/man-options.t b/cpan/podlators/t/man-options.t new file mode 100644 index 0000000000..04895d539c --- /dev/null +++ b/cpan/podlators/t/man-options.t @@ -0,0 +1,175 @@ +#!/usr/bin/perl -w +# +# man-options.t -- Additional tests for Pod::Man options. +# +# Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..7\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; + +# Redirect stderr to a file. +sub stderr_save { + open (OLDERR, '>&STDERR') or die "Can't dup STDERR: $!\n"; + open (STDERR, '> out.err') or die "Can't redirect STDERR: $!\n"; +} + +# Restore stderr. +sub stderr_restore { + close STDERR; + open (STDERR, '>&OLDERR') or die "Can't dup STDERR: $!\n"; + close OLDERR; +} + +$loaded = 1; +print "ok 1\n"; + +my $n = 2; +while (<DATA>) { + my %options; + next until $_ eq "###\n"; + while (<DATA>) { + last if $_ eq "###\n"; + my ($option, $value) = split; + $options{$option} = $value; + } + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + my $parser = Pod::Man->new (%options) or die "Cannot create parser\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + stderr_save; + $parser->parse_from_file ('tmp.pod', \*OUT); + stderr_restore; + close OUT; + my $accents = 0; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + while (<TMP>) { + last if /^\.nh/; + } + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; + open (ERR, 'out.err') or die "Cannot open out.err: $!\n"; + my $errors; + { + local $/; + $errors = <ERR>; + } + close ERR; + unlink ('out.err'); + $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($errors eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected errors:\n ${expected}Errors:\n $errors"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Man. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +fixed CR +fixedbold CY +fixeditalic CW +fixedbolditalic CX +### +=head1 FIXED FONTS + +C<foo B<bar I<baz>> I<bay>> +### +.SH "FIXED FONTS" +.IX Header "FIXED FONTS" +\&\f(CR\*(C`foo \f(CYbar \f(CXbaz\f(CY\f(CR \f(CWbay\f(CR\*(C'\fR +### +### + +### +### +=over 4 + +=item Foo + +Bar. + +=head1 NEXT +### +.IP "Foo" 4 +.IX Item "Foo" +Bar. +.SH "NEXT" +.IX Header "NEXT" +.SH "POD ERRORS" +.IX Header "POD ERRORS" +Hey! \fBThe above document had some coding errors, which are explained below:\fR +.IP "Around line 7:" 4 +.IX Item "Around line 7:" +You forgot a '=back' before '=head1' +### +### + +### +stderr 1 +### +=over 4 + +=item Foo + +Bar. + +=head1 NEXT +### +.IP "Foo" 4 +.IX Item "Foo" +Bar. +.SH "NEXT" +.IX Header "NEXT" +### +tmp.pod around line 7: You forgot a '=back' before '=head1' +### diff --git a/cpan/podlators/t/man-utf8.t b/cpan/podlators/t/man-utf8.t new file mode 100644 index 0000000000..8b44d6b290 --- /dev/null +++ b/cpan/podlators/t/man-utf8.t @@ -0,0 +1,141 @@ +#!/usr/bin/perl -w +# +# man-options.t -- Additional tests for Pod::Man options. +# +# Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..5\n"; + + # UTF-8 support requires Perl 5.8 or later. + if ($] < 5.008) { + my $n; + for $n (1..5) { + print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n"; + } + exit; + } +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; + +$loaded = 1; +print "ok 1\n"; + +my $n = 2; +eval { binmode (\*DATA, ':encoding(utf-8)') }; +eval { binmode (\*STDOUT, ':encoding(utf-8)') }; +while (<DATA>) { + my %options; + next until $_ eq "###\n"; + while (<DATA>) { + last if $_ eq "###\n"; + my ($option, $value) = split; + $options{$option} = $value; + } + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + eval { binmode (\*TMP, ':encoding(utf-8)') }; + print TMP "=encoding utf-8\n\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + my $parser = Pod::Man->new (%options) or die "Cannot create parser\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + my $accents = 0; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + eval { binmode (\*TMP, ':encoding(utf-8)') }; + while (<TMP>) { + $accents = 1 if /Accent mark definitions/; + last if /^\.nh/; + } + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + if (($options{utf8} && !$accents) || (!$options{utf8} && $accents)) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print ($accents ? "Saw accents\n" : "Saw no accents\n"); + print ($options{utf8} ? "Wanted no accents\n" : "Wanted accents\n"); + } + $n++; + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Man. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +utf8 1 +### +=head1 BEYONCÉ + +Beyoncé! Beyoncé! Beyoncé!! + + Beyoncé! Beyoncé! + Beyoncé! Beyoncé! + Beyoncé! Beyoncé! + +Older versions did not convert Beyoncé in verbatim. +### +.SH "BEYONCÉ" +.IX Header "BEYONCÉ" +Beyoncé! Beyoncé! Beyoncé!! +.PP +.Vb 3 +\& Beyoncé! Beyoncé! +\& Beyoncé! Beyoncé! +\& Beyoncé! Beyoncé! +.Ve +.PP +Older versions did not convert Beyoncé in verbatim. +### + +### +utf8 1 +### +=head1 SE<lt>E<gt> output with UTF-8 + +This is S<non-breaking output>. +### +.SH "S<> output with UTF\-8" +.IX Header "S<> output with UTF-8" +This is non-breaking output. +### diff --git a/cpan/podlators/t/man.t b/cpan/podlators/t/man.t new file mode 100644 index 0000000000..419cce3ee6 --- /dev/null +++ b/cpan/podlators/t/man.t @@ -0,0 +1,484 @@ +#!/usr/bin/perl -w +# +# man.t -- Additional specialized tests for Pod::Man. +# +# Copyright 2002, 2003, 2004, 2006, 2007, 2008 +# Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..25\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; + +$loaded = 1; +print "ok 1\n"; + +# Test whether we can use binmode to set encoding. +my $have_encoding = (eval { require PerlIO::encoding; 1 } and not $@); + +my $parser = Pod::Man->new or die "Cannot create parser\n"; +my $n = 2; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + + # We have a test in ISO 8859-1 encoding. Make sure that nothing strange + # happens if Perl thinks the world is Unicode. Wrap this in eval so that + # older versions of Perl don't croak. + eval { binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding }; + + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + while (<OUT>) { last if /^\.nh/ } + my $output; + { + local $/; + $output = <OUT>; + } + close OUT; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected nroff output. +# This is used to test specific features or problems with Pod::Man. The input +# and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 NAME + +gcc - GNU project C and C++ compiler + +=head1 C++ NOTES + +Other mentions of C++. +### +.SH "NAME" +gcc \- GNU project C and C++ compiler +.SH "\*(C+ NOTES" +.IX Header " NOTES" +Other mentions of \*(C+. +### + +### +=head1 PERIODS + +This C<.> should be quoted. +### +.SH "PERIODS" +.IX Header "PERIODS" +This \f(CW\*(C`.\*(C'\fR should be quoted. +### + +### +=over 4 + +=item * + +A bullet. + +=item * + +Another bullet. + +=item * Also a bullet. + +=back +### +.IP "\(bu" 4 +A bullet. +.IP "\(bu" 4 +Another bullet. +.IP "\(bu" 4 +Also a bullet. +### + +### +=over 4 + +=item foo + +Not a bullet. + +=item * + +Also not a bullet. + +=back +### +.IP "foo" 4 +.IX Item "foo" +Not a bullet. +.IP "*" 4 +Also not a bullet. +### + +### +=encoding iso-8859-1 + +=head1 ACCENTS + +Beyonc! Beyonc! Beyonc!! + + Beyonc! Beyonc! + Beyonc! Beyonc! + Beyonc! Beyonc! + +Older versions didn't convert Beyonc in verbatim. +### +.SH "ACCENTS" +.IX Header "ACCENTS" +Beyonce\*'! Beyonce\*'! Beyonce\*'!! +.PP +.Vb 3 +\& Beyonce\*'! Beyonce\*'! +\& Beyonce\*'! Beyonce\*'! +\& Beyonce\*'! Beyonce\*'! +.Ve +.PP +Older versions didn't convert Beyonce\*' in verbatim. +### + +### +=over 4 + +=item 1. Not a number + +=item 2. Spaced right + +=back + +=over 2 + +=item 1 Not a number + +=item 2 Spaced right + +=back +### +.IP "1. Not a number" 4 +.IX Item "1. Not a number" +.PD 0 +.IP "2. Spaced right" 4 +.IX Item "2. Spaced right" +.IP "1 Not a number" 2 +.IX Item "1 Not a number" +.IP "2 Spaced right" 2 +.IX Item "2 Spaced right" +### + +### +=over 4 + +=item Z<>* + +Not bullet. + +=back +### +.IP "*" 4 +Not bullet. +### + +### +=head1 SEQS + +"=over ... Z<>=back" + +"SE<lt>...E<gt>" + +The quotes should be converted in the above to paired quotes. +### +.SH "SEQS" +.IX Header "SEQS" +\&\*(L"=over ... =back\*(R" +.PP +\&\*(L"S<...>\*(R" +.PP +The quotes should be converted in the above to paired quotes. +### + +### +=head1 YEN + +It cost me E<165>12345! That should be an X. +### +.SH "YEN" +.IX Header "YEN" +It cost me X12345! That should be an X. +### + +### +=head1 agrave + +Open E<agrave> la shell. Previous versions mapped it wrong. +### +.SH "agrave" +.IX Header "agrave" +Open a\*` la shell. Previous versions mapped it wrong. +### + +### +=over + +=item First level + +Blah blah blah.... + +=over + +=item * + +Should be a bullet. + +=back + +=back +### +.IP "First level" 4 +.IX Item "First level" +Blah blah blah.... +.RS 4 +.IP "\(bu" 4 +Should be a bullet. +.RE +.RS 4 +.RE +### + +### +=over 4 + +=item 1. Check fonts in @CARP_NOT test. + +=back +### +.ie n .IP "1. Check fonts in @CARP_NOT test." 4 +.el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4 +.IX Item "1. Check fonts in @CARP_NOT test." +### + +### +=head1 LINK QUOTING + +There should not be double quotes: L<C<< (?>pattern) >>>. +### +.SH "LINK QUOTING" +.IX Header "LINK QUOTING" +There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR. +### + +### +=head1 SE<lt>E<gt> MAGIC + +Magic should be applied S<RISC OS> to that. +### +.SH "S<> MAGIC" +.IX Header "S<> MAGIC" +Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that. +### + +### +=head1 MAGIC MONEY + +These should be identical. + +Bippity boppity boo "The +price is $Z<>100." + +Bippity boppity boo "The +price is $100." +### +.SH "MAGIC MONEY" +.IX Header "MAGIC MONEY" +These should be identical. +.PP +Bippity boppity boo \*(L"The +price is \f(CW$100\fR.\*(R" +.PP +Bippity boppity boo \*(L"The +price is \f(CW$100\fR.\*(R" +### + +### +=head1 NAME + +"Stuff" (no guesswork) + +=head2 THINGS + +Oboy, is this C++ "fun" yet! (guesswork) +### +.SH "NAME" +"Stuff" (no guesswork) +.SS "\s-1THINGS\s0" +.IX Subsection "THINGS" +Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork) +### + +### +=head1 Newline C Quote Weirdness + +Blorp C<' +''>. Yes. +### +.SH "Newline C Quote Weirdness" +.IX Header "Newline C Quote Weirdness" +Blorp \f(CW\*(Aq +\&\*(Aq\*(Aq\fR. Yes. +### + +### +=head1 Soft Hypen Testing + +sigE<shy>action +manuE<shy>script +JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi + +And again: + +sigE<173>action +manuE<173>script +JarkE<173>ko HieE<173>taE<173>nieE<173>mi + +And one more time: + +sigE<0x00AD>action +manuE<0x00AD>script +JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi +### +.SH "Soft Hypen Testing" +.IX Header "Soft Hypen Testing" +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi +.PP +And again: +.PP +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi +.PP +And one more time: +.PP +sig\%action +manu\%script +Jark\%ko Hie\%ta\%nie\%mi +### + +### +=head1 XE<lt>E<gt> Whitespace + +Blorpy L<B<prok>|blap> X<bivav> wugga chachacha. +### +.SH "X<> Whitespace" +.IX Header "X<> Whitespace" +Blorpy \fBprok\fR wugga chachacha. +.IX Xref "bivav" +### + +### +=head1 Hyphen in SE<lt>E<gt> + +Don't S<transform even-this hyphen>. This "one's-fine!", as well. However, +$-0.13 should have a real hyphen. +### +.SH "Hyphen in S<>" +.IX Header "Hyphen in S<>" +Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However, +$\-0.13 should have a real hyphen. +### + +### +=head1 Quote escaping + +Don't escape `this' but do escape C<`this'> (and don't surround it in quotes). +### +.SH "Quote escaping" +.IX Header "Quote escaping" +Don't escape `this' but do escape \f(CW\`this\*(Aq\fR (and don't surround it in quotes). +### + +### +=pod + +E<eth> +### +.PP +\&\*(d- +### + +### +=head1 C<one> and C<two> +### +.ie n .SH """one"" and ""two""" +.el .SH "\f(CWone\fP and \f(CWtwo\fP" +.IX Header "one and two" +### + +### +=pod + +Some text. + +=for man +Some raw nroff. + +=for roff \fBBold text.\fP + +=for html +Stuff that's hidden. + +=for MAN \fIItalic text.\fP + +=for ROFF +.PP +\&A paragraph. + +More text. +### +Some text. +Some raw nroff. +\fBBold text.\fP +\fIItalic text.\fP +.PP +\&A paragraph. +.PP +More text. +### diff --git a/cpan/podlators/t/parselink.t b/cpan/podlators/t/parselink.t new file mode 100644 index 0000000000..c5c2bb660b --- /dev/null +++ b/cpan/podlators/t/parselink.t @@ -0,0 +1,132 @@ +#!/usr/bin/perl -w +# +# parselink.t -- Tests for Pod::ParseLink. +# +# Copyright 2001 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +# The format of each entry in this array is the L<> text followed by the +# five-element parse returned by parselink. When adding a new test, also +# increment the test count in the BEGIN block below. We don't use any of the +# fancy test modules intentionally for backward compatibility to older +# versions of Perl. +@TESTS = ( + [ 'foo', + undef, 'foo', 'foo', undef, 'pod' ], + + [ 'foo|bar', + 'foo', 'foo', 'bar', undef, 'pod' ], + + [ 'foo/bar', + undef, '"bar" in foo', 'foo', 'bar', 'pod' ], + + [ 'foo/"baz boo"', + undef, '"baz boo" in foo', 'foo', 'baz boo', 'pod' ], + + [ '/bar', + undef, '"bar"', undef, 'bar', 'pod' ], + + [ '/"baz boo"', + undef, '"baz boo"', undef, 'baz boo', 'pod' ], + + [ '/baz boo', + undef, '"baz boo"', undef, 'baz boo', 'pod' ], + + [ 'foo bar/baz boo', + undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod' ], + + [ 'foo bar / baz boo', + undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod' ], + + [ "foo\nbar\nbaz\n/\nboo", + undef, '"boo" in foo bar baz', 'foo bar baz', 'boo', 'pod' ], + + [ 'anchor|name/section', + 'anchor', 'anchor', 'name', 'section', 'pod' ], + + [ '"boo var baz"', + undef, '"boo var baz"', undef, 'boo var baz', 'pod' ], + + [ 'bar baz', + undef, '"bar baz"', undef, 'bar baz', 'pod' ], + + [ '"boo bar baz / baz boo"', + undef, '"boo bar baz / baz boo"', undef, 'boo bar baz / baz boo', + 'pod' ], + + [ 'fooZ<>bar', + undef, 'fooZ<>bar', 'fooZ<>bar', undef, 'pod' ], + + [ 'Testing I<italics>|foo/bar', + 'Testing I<italics>', 'Testing I<italics>', 'foo', 'bar', 'pod' ], + + [ 'foo/I<Italic> text', + undef, '"I<Italic> text" in foo', 'foo', 'I<Italic> text', 'pod' ], + + [ 'fooE<verbar>barZ<>/Section C<with> I<B<other> markup', + undef, '"Section C<with> I<B<other> markup" in fooE<verbar>barZ<>', + 'fooE<verbar>barZ<>', 'Section C<with> I<B<other> markup', 'pod' ], + + [ 'Nested L<http://www.perl.org/>|fooE<sol>bar', + 'Nested L<http://www.perl.org/>', 'Nested L<http://www.perl.org/>', + 'fooE<sol>bar', undef, 'pod' ], + + [ 'ls(1)', + undef, 'ls(1)', 'ls(1)', undef, 'man' ], + + [ ' perlfunc(1)/open ', + undef, '"open" in perlfunc(1)', 'perlfunc(1)', 'open', 'man' ], + + [ 'some manual page|perl(1)', + 'some manual page', 'some manual page', 'perl(1)', undef, 'man' ], + + [ 'http://www.perl.org/', + undef, 'http://www.perl.org/', 'http://www.perl.org/', undef, 'url' ], + + [ 'news:yld72axzc8.fsf@windlord.stanford.edu', + undef, 'news:yld72axzc8.fsf@windlord.stanford.edu', + 'news:yld72axzc8.fsf@windlord.stanford.edu', undef, 'url' ] +); + +BEGIN { + chdir 't' if -d 't'; + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..25\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::ParseLink; +$loaded = 1; +print "ok 1\n"; + +# Used for reporting test failures. +my @names = qw(text inferred name section type); + +my $n = 2; +for (@TESTS) { + my @expected = @$_; + my $link = shift @expected; + my @results = parselink ($link); + my $okay = 1; + for (0..4) { + # Make sure to check undef explicitly; we don't want undef to match + # the empty string because they're semantically different. + unless ((!defined ($results[$_]) && !defined ($expected[$_])) + || (defined ($results[$_]) && defined ($expected[$_]) + && $results[$_] eq $expected[$_])) { + print "not ok $n\n" if $okay; + print "# Incorrect $names[$_]:\n"; + print "# expected: $expected[$_]\n"; + print "# seen: $results[$_]\n"; + $okay = 0; + } + } + print "ok $n\n" if $okay; + $n++; +} diff --git a/cpan/podlators/t/pod-parser.t b/cpan/podlators/t/pod-parser.t new file mode 100644 index 0000000000..318a76bc15 --- /dev/null +++ b/cpan/podlators/t/pod-parser.t @@ -0,0 +1,102 @@ +#!/usr/bin/perl -w +# +# pod-parser.t -- Tests for backward compatibility with Pod::Parser. +# +# Copyright 2006, 2008 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..4\n"; +} + +my $loaded; + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Man; +use Pod::Text; +use strict; + +$loaded = 1; +print "ok 1\n"; + +my $parser = Pod::Man->new or die "Cannot create parser\n"; +open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; +print TMP "Some random B<text>.\n"; +close TMP; +open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; +$parser->parse_from_file ({ -cutting => 0 }, 'tmp.pod', \*OUT); +close OUT; +open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; +while (<OUT>) { last if /^\.nh/ } +my $output; +{ + local $/; + $output = <OUT>; +} +close OUT; +if ($output eq "Some random \\fBtext\\fR.\n") { + print "ok 2\n"; +} else { + print "not ok 2\n"; + print "Expected\n========\nSome random \\fBtext\\fR.\n\n"; + print "Output\n======\n$output\n"; +} + +$parser = Pod::Text->new or die "Cannot create parser\n"; +open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; +$parser->parse_from_file ({ -cutting => 0 }, 'tmp.pod', \*OUT); +close OUT; +open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; +{ + local $/; + $output = <OUT>; +} +close OUT; +if ($output eq " Some random text.\n\n") { + print "ok 3\n"; +} else { + print "not ok 3\n"; + print "Expected\n========\n Some random text.\n\n\n"; + print "Output\n======\n$output\n"; +} + +# Test the pod2text function, particularly with only one argument. +open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; +print TMP "=pod\n\nSome random B<text>.\n"; +close TMP; +open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; +open (SAVE, '>&STDOUT') or die "Cannot dup stdout: $!\n"; +open (STDOUT, '>&OUT') or die "Cannot replace stdout: $!\n"; +pod2text ('tmp.pod'); +close OUT; +open (STDOUT, '>&SAVE') or die "Cannot fix stdout: $!\n"; +close SAVE; +open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; +{ + local $/; + $output = <OUT>; +} +close OUT; +if ($output eq " Some random text.\n\n") { + print "ok 4\n"; +} else { + print "not ok 4\n"; + print "Expected\n========\n Some random text.\n\n\n"; + print "Output\n======\n$output\n"; +} + +unlink ('tmp.pod', 'out.tmp'); +exit 0; diff --git a/cpan/podlators/t/pod-spelling.t b/cpan/podlators/t/pod-spelling.t new file mode 100644 index 0000000000..41c902782e --- /dev/null +++ b/cpan/podlators/t/pod-spelling.t @@ -0,0 +1,76 @@ +#!/usr/bin/perl +# +# t/pod-spelling.t -- Test POD spelling. +# +# Copyright 2008 Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +# Called to skip all tests with a reason. +sub skip_all { + print "1..0 # Skipped: @_\n"; + exit; +} + +# Skip all spelling tests unless flagged to run maintainer tests. +skip_all "Spelling tests only run for maintainer" + unless $ENV{RRA_MAINTAINER_TESTS}; + +# Make sure we have prerequisites. hunspell is currently not supported due to +# lack of support for contractions. +eval 'use Test::Pod 1.00'; +skip_all "Test::Pod 1.00 required for testing POD" if $@; +eval 'use Pod::Spell'; +skip_all "Pod::Spell required to test POD spelling" if $@; +my @spell; +my %options = (aspell => [ qw(-d en_US --home-dir=./ list) ], + ispell => [ qw(-d american -l -p /dev/null) ]); +SEARCH: for my $program (qw/aspell ispell/) { + for my $dir (split ':', $ENV{PATH}) { + if (-x "$dir/$program") { + @spell = ("$dir/$program", @{ $options{$program} }); + } + last SEARCH if @spell; + } +} +skip_all "aspell or ispell required to test POD spelling" unless @spell; + +# Run the test, one for each POD file. +$| = 1; +my @pod = all_pod_files (); +my $count = scalar @pod; +print "1..$count\n"; +my $n = 1; +for my $pod (@pod) { + my $child = open (CHILD, '-|'); + if (not defined $child) { + die "Cannot fork: $!\n"; + } elsif ($child == 0) { + my $pid = open (SPELL, '|-', @spell) + or die "Cannot run @spell: $!\n"; + open (POD, '<', $pod) or die "Cannot open $pod: $!\n"; + my $parser = Pod::Spell->new; + $parser->parse_from_filehandle (\*POD, \*SPELL); + close POD; + close SPELL; + exit ($? >> 8); + } else { + my @words = <CHILD>; + close CHILD; + if ($? != 0) { + print "ok $n # skip - @spell failed: $?\n"; + } elsif (@words) { + for (@words) { + s/^\s+//; + s/\s+$//; + } + print "not ok $n\n"; + print " - Misspelled words found in $pod\n"; + print " @words\n"; + } else { + print "ok $n\n"; + } + $n++; + } +} diff --git a/cpan/podlators/t/pod.t b/cpan/podlators/t/pod.t new file mode 100644 index 0000000000..ecb37a642c --- /dev/null +++ b/cpan/podlators/t/pod.t @@ -0,0 +1,11 @@ +#!/usr/bin/perl +# +# t/pod.t -- Test POD formatting. + +eval 'use Test::Pod 1.00'; +if ($@) { + print "1..1\n"; + print "ok 1 # skip - Test::Pod 1.00 required for testing POD\n"; + exit; +} +all_pod_files_ok (); diff --git a/cpan/podlators/t/termcap.t b/cpan/podlators/t/termcap.t new file mode 100644 index 0000000000..5ec98288f6 --- /dev/null +++ b/cpan/podlators/t/termcap.t @@ -0,0 +1,85 @@ +#!/usr/bin/perl -w +# +# termcap.t -- Additional specialized tests for Pod::Text::Termcap. +# +# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..2\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +# Hard-code a few values to try to get reproducible results. +$ENV{COLUMNS} = 80; +$ENV{TERM} = 'xterm'; +$ENV{TERMCAP} = 'xterm:co=80:do=^J:md=\E[1m:us=\E[4m:me=\E[m'; + +use Pod::Text::Termcap; + +$loaded = 1; +print "ok 1\n"; + +my $parser = Pod::Text::Termcap->new or die "Cannot create parser\n"; +my $n = 2; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected output. This is +# used to test specific features or problems with Pod::Text::Termcap. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 WRAPPING + +B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>. +### +[1mWRAPPING[m + [1m[4mDo[m[m [4m[1mnot[m[m [1m[4minclude[m[m [1m[4mformatting codes when[m[m [1m[4mwrapping[m[m. + +### diff --git a/cpan/podlators/t/text-encoding.t b/cpan/podlators/t/text-encoding.t new file mode 100644 index 0000000000..c803cff1f9 --- /dev/null +++ b/cpan/podlators/t/text-encoding.t @@ -0,0 +1,142 @@ +#!/usr/bin/perl -w +# +# text-encoding.t -- Test Pod::Text with various weird encoding combinations. +# +# Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..4\n"; + + # PerlIO encoding support requires Perl 5.8 or later. + if ($] < 5.008) { + my $n; + for $n (1..4) { + print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n"; + } + exit; + } +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Text; + +$loaded = 1; +print "ok 1\n"; + +my $n = 2; +eval { binmode (\*DATA, ':raw') }; +eval { binmode (\*STDOUT, ':raw') }; +while (<DATA>) { + my %opts; + $opts{utf8} = 1 if $n == 4; + my $parser = Pod::Text->new (%opts) or die "Cannot create parser\n"; + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + eval { binmode (\*TMP, ':raw') }; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + eval { binmode (\*OUT, ':raw') }; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + eval { binmode (\*TMP, ':raw') }; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Text. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 Test of SE<lt>E<gt> + +This is S<some whitespace>. +### +Test of S<> + This is some whitespace. + +### + +### +=encoding utf-8 + +=head1 I can eat glass + +=over 4 + +=item Esperanto + +Mi povas manÄi vitron, Äi ne damaÄas min. + +=item Braille + +â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â â ¥â â â â â + +=item Hindi + +मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤ à¤à¤° मà¥à¤à¥ à¤à¤¸à¤¸à¥ à¤à¥à¤ à¤à¥à¤ नहà¥à¤ पहà¥à¤à¤à¤¤à¥. + +=back + +See L<http://www.columbia.edu/kermit/utf8.html> +### +I can eat glass + Esperanto + Mi povas manÄi vitron, Äi ne damaÄas min. + + Braille + â â â â â â â â â â â â â â â â â â â â â â â + â â â â â â â â â ¥â â â â â + + Hindi + मà¥à¤ à¤à¤¾à¤à¤ à¤à¤¾ सà¤à¤¤à¤¾ हà¥à¤ à¤à¤° + मà¥à¤à¥ à¤à¤¸à¤¸à¥ à¤à¥à¤ à¤à¥à¤ नहà¥à¤ + पहà¥à¤à¤à¤¤à¥. + + See <http://www.columbia.edu/kermit/utf8.html> + +### + +### +=head1 Beyoncé +### +Beyoncé +### diff --git a/cpan/podlators/t/text-options.t b/cpan/podlators/t/text-options.t new file mode 100644 index 0000000000..8a115d83a5 --- /dev/null +++ b/cpan/podlators/t/text-options.t @@ -0,0 +1,271 @@ +#!/usr/bin/perl -w +# +# text-options.t -- Additional tests for Pod::Text options. +# +# Copyright 2002, 2004, 2006, 2008 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..13\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Text; + +# Redirect stderr to a file. +sub stderr_save { + open (OLDERR, '>&STDERR') or die "Can't dup STDERR: $!\n"; + open (STDERR, '> out.err') or die "Can't redirect STDERR: $!\n"; +} + +# Restore stderr. +sub stderr_restore { + close STDERR; + open (STDERR, '>&OLDERR') or die "Can't dup STDERR: $!\n"; + close OLDERR; +} + +$loaded = 1; +print "ok 1\n"; + +my $n = 2; +while (<DATA>) { + my %options; + next until $_ eq "###\n"; + while (<DATA>) { + last if $_ eq "###\n"; + my ($option, $value) = split; + $options{$option} = $value; + } + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + my $parser = Pod::Text->new (%options) or die "Cannot create parser\n"; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + stderr_save; + $parser->parse_from_file ('tmp.pod', \*OUT); + stderr_restore; + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + 1 while unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; + open (ERR, 'out.err') or die "Cannot open out.err: $!\n"; + my $errors; + { + local $/; + $errors = <ERR>; + } + close ERR; + unlink ('out.err'); + $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($errors eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected errors:\n ${expected}Errors:\n $errors"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Text. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +alt 1 +### +=head1 SAMPLE + +=over 4 + +=item F + +Paragraph. + +=item Bar + +=item B + +Paragraph. + +=item Longer + +Paragraph. + +=back + +### + +==== SAMPLE ==== + +: F Paragraph. + +: Bar +: B Paragraph. + +: Longer + Paragraph. + +### +### + +### +margin 4 +### +=head1 SAMPLE + +This is some body text that is long enough to be a paragraph that wraps, +thereby testing margins with wrapped paragraphs. + + This is some verbatim text. + +=over 6 + +=item Test + +This is a test of an indented paragraph. + +This is another indented paragraph. + +=back +### + SAMPLE + This is some body text that is long enough to be a paragraph that + wraps, thereby testing margins with wrapped paragraphs. + + This is some verbatim text. + + Test This is a test of an indented paragraph. + + This is another indented paragraph. + +### +### + +### +code 1 +### +This is some random text. +This is more random text. + +This is some random text. +This is more random text. + +=head1 SAMPLE + +This is POD. + +=cut + +This is more random text. +### +This is some random text. +This is more random text. + +This is some random text. +This is more random text. + +SAMPLE + This is POD. + + +This is more random text. +### +### + +### +sentence 1 +### +=head1 EXAMPLE + +Whitespace around C<< this. >> must be ignored per perlpodspec. >> +needs to eat all of the space in front of it. + +=cut +### +EXAMPLE + Whitespace around "this." must be ignored per perlpodspec. >> needs to + eat all of the space in front of it. + +### +### + +### +### +=over 4 + +=item Foo + +Bar. + +=head1 NEXT +### + Foo Bar. + +NEXT +POD ERRORS + Hey! The above document had some coding errors, which are explained + below: + + Around line 7: + You forgot a '=back' before '=head1' + +### +### + +### +stderr 1 +### +=over 4 + +=item Foo + +Bar. + +=head1 NEXT +### + Foo Bar. + +NEXT +### +tmp.pod around line 7: You forgot a '=back' before '=head1' +### diff --git a/cpan/podlators/t/text-utf8.t b/cpan/podlators/t/text-utf8.t new file mode 100644 index 0000000000..806947827e --- /dev/null +++ b/cpan/podlators/t/text-utf8.t @@ -0,0 +1,129 @@ +#!/usr/bin/perl -w +# +# text-utf8.t -- Test Pod::Text with UTF-8 input. +# +# Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..3\n"; + + # UTF-8 support requires Perl 5.8 or later. + if ($] < 5.008) { + my $n; + for $n (1..3) { + print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n"; + } + exit; + } +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Text; + +$loaded = 1; +print "ok 1\n"; + +my $parser = Pod::Text->new or die "Cannot create parser\n"; +my $n = 2; +eval { binmode (\*DATA, ':encoding(utf-8)') }; +eval { binmode (\*STDOUT, ':encoding(utf-8)') }; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + eval { binmode (\*TMP, ':encoding(utf-8)') }; + print TMP "=encoding UTF-8\n\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + eval { binmode (\*TMP, ':encoding(utf-8)') }; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Text. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 Test of SE<lt>E<gt> + +This is S<some whitespace>. +### +Test of S<> + This is some whitespace. + +### + +### +=head1 I can eat glass + +=over 4 + +=item Esperanto + +Mi povas manĝi vitron, ĝi ne damaĝas min. + +=item Braille + +⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑ + +=item Hindi + +मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती. + +=back + +See L<http://www.columbia.edu/kermit/utf8.html> +### +I can eat glass + Esperanto + Mi povas manĝi vitron, ĝi ne damaĝas min. + + Braille + ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑ + + Hindi + मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती. + + See <http://www.columbia.edu/kermit/utf8.html> + +### diff --git a/cpan/podlators/t/text.t b/cpan/podlators/t/text.t new file mode 100644 index 0000000000..c96acba63d --- /dev/null +++ b/cpan/podlators/t/text.t @@ -0,0 +1,147 @@ +#!/usr/bin/perl -w +# +# text.t -- Additional specialized tests for Pod::Text. +# +# Copyright 2002, 2004, 2006, 2007, 2008, 2009 Russ Allbery <rra@stanford.edu> +# +# This program is free software; you may redistribute it and/or modify it +# under the same terms as Perl itself. + +BEGIN { + chdir 't' if -d 't'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } else { + unshift (@INC, '../blib/lib'); + } + unshift (@INC, '../blib/lib'); + $| = 1; + print "1..6\n"; +} + +END { + print "not ok 1\n" unless $loaded; +} + +use Pod::Text; +use Pod::Simple; + +$loaded = 1; +print "ok 1\n"; + +my $parser = Pod::Text->new or die "Cannot create parser\n"; +my $n = 2; +while (<DATA>) { + next until $_ eq "###\n"; + open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; + while (<DATA>) { + last if $_ eq "###\n"; + print TMP $_; + } + close TMP; + open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; + $parser->parse_from_file ('tmp.pod', \*OUT); + close OUT; + open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n"; + my $output; + { + local $/; + $output = <TMP>; + } + close TMP; + unlink ('tmp.pod', 'out.tmp'); + my $expected = ''; + while (<DATA>) { + last if $_ eq "###\n"; + $expected .= $_; + } + if ($output eq $expected) { + print "ok $n\n"; + } elsif ($n == 4 && $Pod::Simple::VERSION < 3.06) { + print "ok $n # skip Pod::Simple S<> parsing bug\n"; + } else { + print "not ok $n\n"; + print "Expected\n========\n$expected\nOutput\n======\n$output\n"; + } + $n++; +} + +# Below the marker are bits of POD and corresponding expected text output. +# This is used to test specific features or problems with Pod::Text. The +# input and output are separated by lines containing only ###. + +__DATA__ + +### +=head1 PERIODS + +This C<.> should be quoted. +### +PERIODS + This "." should be quoted. + +### + +### +=head1 CE<lt>E<gt> WITH SPACES + +What does C<< this. >> end up looking like? +### +C<> WITH SPACES + What does "this." end up looking like? + +### + +### +=head1 Test of SE<lt>E<gt> + +This is some S< > whitespace. +### +Test of S<> + This is some whitespace. + +### + +### +=head1 Test of =for + +=for comment +This won't be seen. + +Yes. + +=for text +This should be seen. + +=for TEXT As should this. + +=for man +But this shouldn't. + +Some more text. +### +Test of =for + Yes. + +This should be seen. +As should this. + Some more text. + +### + +### +=pod + +text + + line1 + + line3 +### + text + + line1 + + line3 + +### |