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
Parse lists properly, makes 06-lists.t
- Loading branch information
Tadeusz Sośnierz
committed
Jul 7, 2011
1 parent
48ed49c
commit 3a828b7
Showing
4 changed files
with
129 additions
and
9 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
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,105 @@ | ||
| use Test; | ||
| plan 31; | ||
| my $r; | ||
|
|
||
| =begin pod | ||
| The seven suspects are: | ||
| =item Happy | ||
| =item Dopey | ||
| =item Sleepy | ||
| =item Bashful | ||
| =item Sneezy | ||
| =item Grumpy | ||
| =item Keyser Soze | ||
| =end pod | ||
|
|
||
| $r = $POD[0]; | ||
| is $r.content.elems, 8; | ||
| for 1..7 { | ||
| isa_ok $r.content[$_], Pod__Item; | ||
| } | ||
|
|
||
| is $r.content[1].content, 'Happy', 'content is happy :)'; | ||
| is $r.content[2].content, 'Dopey'; | ||
| is $r.content[7].content, 'Keyser Soze'; | ||
| nok $r.content[4].level.defined, 'no level information'; | ||
|
|
||
| =begin pod | ||
| =item1 Animal | ||
| =item2 Vertebrate | ||
| =item2 Invertebrate | ||
| =item1 Phase | ||
| =item2 Solid | ||
| =item2 Liquid | ||
| =item2 Gas | ||
| =item2 Chocolate | ||
| =end pod | ||
|
|
||
| $r = $POD[1]; | ||
| is $r.content.elems, 8; | ||
| for 0..7 { | ||
| isa_ok $r.content[$_], Pod__Item; | ||
| } | ||
|
|
||
| $r.content[0].content, 'Animal'; | ||
| $r.content[0].level, 1; | ||
| $r.content[2].content, 'Invertebrate'; | ||
| $r.content[2].level, 2; | ||
| $r.content[3].content, 'Phase'; | ||
| $r.content[3].level, 1; | ||
| $r.content[4].content, 'Solid'; | ||
| $r.content[4].level, 2; | ||
|
|
||
| =begin pod | ||
| =comment CORRECT... | ||
| =begin item1 | ||
| The choices are: | ||
| =end item1 | ||
| =item2 Liberty | ||
| =item2 Death | ||
| =item2 Beer | ||
| =end pod | ||
|
|
||
| $r = $POD[2]; | ||
| is $r.content.elems, 5; | ||
| for 1..4 { | ||
| isa_ok $r.content[$_], Pod__Item; | ||
| } | ||
|
|
||
| # XXX Those items are :numbered in S26, but we're waiting with block | ||
| # configuration until we're inside Rakudo, otherwise we'll have to | ||
| # pretty much implement Pair parsing in gsocmess only to get rid of | ||
| # it later. | ||
|
|
||
| =begin pod | ||
| Let's consider two common proverbs: | ||
| =begin item | ||
| I<The rain in Spain falls mainly on the plain.> | ||
| This is a common myth and an unconscionable slur on the Spanish | ||
| people, the majority of whom are extremely attractive. | ||
| =end item | ||
| =begin item | ||
| I<The early bird gets the worm.> | ||
| In deciding whether to become an early riser, it is worth | ||
| considering whether you would actually enjoy annelids | ||
| for breakfast. | ||
| =end item | ||
| As you can see, folk wisdom is often of dubious value. | ||
| =end pod | ||
|
|
||
| $r = $POD[3]; | ||
| is $r.content.elems, 4; | ||
| is $r.content[0], "Let's consider two common proverbs:"; | ||
| skip 'no regexes in nom yet', 2; | ||
| #ok $r.content[1].content.Str | ||
| # ~~ /:s This is a common .+ are extremely attractive/; | ||
| #ok $r.content[2].content.Str | ||
| # ~~ /:s In deciding .+ annelids for breakfast/; | ||
| is $r.content[3], "As you can see, folk wisdom is often of dubious value."; |