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 the simple case of tables
- Loading branch information
Tadeusz Sośnierz
committed
Jul 5, 2011
1 parent
4a1e0ad
commit 8e69807
Showing
3 changed files
with
120 additions
and
5 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,52 @@ | ||
| use Test; | ||
| use Pod6; | ||
| plan *; | ||
| my ($x, $r); | ||
|
|
||
| #you can create tables compactly, line-by-line | ||
|
|
||
| $x = q[ | ||
| =begin pod | ||
| =begin table | ||
| The Shoveller Eddie Stevens King Arthur's singing shovel | ||
| Blue Raja Geoffrey Smith Master of cutlery | ||
| Mr Furious Roy Orson Ticking time bomb of fury | ||
| The Bowler Carol Pinnsler Haunted bowling ball | ||
| =end table | ||
| =end pod | ||
| ]; | ||
|
|
||
| $r = Pod6::parse($x); | ||
| my $t = $r.content[0]; | ||
| isa_ok $t, Pod6::Block::Table; | ||
| is $t.content[0][0], 'The Shoveller'; | ||
| is $t.content[0][1], 'Eddie Stevens'; | ||
| is $t.content[0][2], "King Arthur's singing shovel"; | ||
| is $t.content[1][0], 'Blue Raja'; | ||
| is $t.content[1][1], 'Geoffrey Smith'; | ||
| is $t.content[1][2], 'Master of cutlery'; | ||
| is $t.content[2][0], 'Mr Furious'; | ||
| is $t.content[2][1], 'Roy Orson'; | ||
| is $t.content[2][2], 'Ticking time bomb of fury'; | ||
| is $t.content[3][0], 'The Bowler'; | ||
| is $t.content[3][1], 'Carol Pinnsler'; | ||
| is $t.content[3][2], 'Haunted bowling ball'; | ||
|
|
||
| $x = q[ | ||
| =table | ||
| Constants 1 | ||
| Variables 10 | ||
| Subroutines 33 | ||
| Everything else 57 | ||
| ]; | ||
| $r = Pod6::parse($x); | ||
| is $r.content[0][0], 'Constants'; | ||
| is $r.content[1][0], 'Variables'; | ||
| is $r.content[2][0], 'Subroutines'; | ||
| is $r.content[3][0], 'Everything else'; | ||
| is $r.content[0][1], '1'; | ||
| is $r.content[1][1], '10'; | ||
| is $r.content[2][1], '33'; | ||
| is $r.content[3][1], '57'; | ||
|
|
||
| done; |