Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Handle code blocks properly, import 04-code.t
- Loading branch information
Tadeusz Sośnierz
committed
Jul 7, 2011
1 parent
74bfbe4
commit 571755c
Showing
3 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| use Test; | ||
| plan 45; | ||
| my $r; | ||
|
|
||
| =begin pod | ||
| This ordinary paragraph introduces a code block: | ||
| $this = 1 * code('block'); | ||
| $which.is_specified(:by<indenting>); | ||
| =end pod | ||
|
|
||
| $r = $POD[0]; | ||
| is $r.content[0], 'This ordinary paragraph introduces a code block:'; | ||
| isa_ok $r.content[1], Pod__Block__Code; | ||
| is $r.content[1].content.Str, q[$this = 1 * code('block'); | ||
| $which.is_specified(:by<indenting>);]; | ||
|
|
||
| # more fancy code blocks | ||
| =begin pod | ||
| This is an ordinary paragraph | ||
|
|
||
| While this is not | ||
| This is a code block | ||
|
|
||
| =head1 Mumble mumble | ||
| Suprisingly, this is a code block again | ||
| (with fancy indentation too) | ||
|
|
||
| But this is just a text. Again | ||
|
|
||
| =end pod | ||
| $r = $POD[1]; | ||
| is $r.content.elems, 5; | ||
| is $r.content[0], 'This is an ordinary paragraph'; | ||
| isa_ok $r.content[1], Pod__Block__Code; | ||
| is $r.content[1].content, "While this is not\nThis is a code block"; | ||
| isa_ok $r.content[2], Pod__Block; | ||
| is $r.content[2].content, 'Mumble mumble'; | ||
| isa_ok $r.content[3], Pod__Block__Code; | ||
| is $r.content[3].content, "Suprisingly, this is a code block again\n" | ||
| ~ " (with fancy indentation too)"; | ||
| is $r.content[4], "But this is just a text. Again"; | ||
|
|
||
| =begin pod | ||
| Tests for the feed operators | ||
| ==> and <== | ||
| =end pod | ||
|
|
||
| $r = $POD[2]; | ||
| is $r.content[0], 'Tests for the feed operators'; | ||
| isa_ok $r.content[1], Pod__Block__Code; | ||
| is $r.content[1].content, "==> and <=="; | ||
|
|
||
| =begin pod | ||
| Fun comes | ||
| This is code | ||
| Ha, what now? | ||
| one more block of code | ||
| just to make sure it works | ||
| or better: maybe it'll break! | ||
| =end pod | ||
|
|
||
| $r = $POD[3]; | ||
| is $r.content.elems, 4; | ||
| is $r.content[0], 'Fun comes'; | ||
| isa_ok $r.content[1], Pod__Block__Code; | ||
| is $r.content[1].content, 'This is code'; | ||
| isa_ok $r.content[2], Pod__Block__Code; | ||
| is $r.content[2].content, 'Ha, what now?'; | ||
| isa_ok $r.content[3], Pod__Block__Code; | ||
| is $r.content[3].content, "one more block of code\n" | ||
| ~ "just to make sure it works\n" | ||
| ~ " or better: maybe it'll break!"; | ||
|
|
||
| =begin pod | ||
| =head1 A heading | ||
| This is Pod too. Specifically, this is a simple C<para> block | ||
| $this = pod('also'); # Specifically, a code block | ||
| =end pod | ||
|
|
||
| $r = $POD[4]; | ||
| is $r.content.elems, 3; | ||
| isa_ok $r.content[0], Pod__Block; | ||
| is $r.content[0].content, 'A heading'; | ||
| is $r.content[1], | ||
| 'This is Pod too. Specifically, this is a simple C<para> block'; | ||
| isa_ok $r.content[2], Pod__Block__Code; | ||
| is $r.content[2].content, | ||
| q[$this = pod('also'); # Specifically, a code block]; | ||
|
|
||
| =begin pod | ||
| this is code | ||
| =for podcast | ||
| this is not | ||
| this is code | ||
| =begin itemization | ||
| this is not | ||
| =end itemization | ||
| =begin quitem | ||
| and this is not | ||
| =end quitem | ||
| =item | ||
| and this is! | ||
| =end pod | ||
|
|
||
| $r = $POD[5]; | ||
| is $r.content.elems, 6; | ||
| isa_ok $r.content[0], Pod__Block__Code; | ||
| is $r.content[0].content, 'this is code'; | ||
|
|
||
| isa_ok $r.content[1], Pod__Block__Named; | ||
| is $r.content[1].name, 'podcast'; | ||
| is $r.content[1].content, 'this is not'; | ||
|
|
||
| isa_ok $r.content[2], Pod__Block__Code; | ||
| is $r.content[2].content, 'this is code'; | ||
|
|
||
| isa_ok $r.content[3], Pod__Block__Named; | ||
| is $r.content[3].name, 'itemization'; | ||
| is $r.content[3].content, 'this is not'; | ||
|
|
||
| isa_ok $r.content[4], Pod__Block__Named; | ||
| is $r.content[4].name, 'quitem'; | ||
| is $r.content[4].content, 'and this is not'; | ||
|
|
||
| isa_ok $r.content[5].content[0], Pod__Block__Code; | ||
| is $r.content[5].content[0].content, 'and this is!'; |