Skip to content

Commit

Permalink
Of course there could be tests without Albi. But the joy I'll miss...
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed May 22, 2011
1 parent 9760398 commit b501e36
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 11 deletions.
21 changes: 14 additions & 7 deletions t/01-delimited.t
Expand Up @@ -81,12 +81,17 @@ isa_ok $r, Pod6::Block;
is $r.content.elems, 5, '5 sub-nodes in foo';
is $r.content[0],
'and so, all of the villages chased Albi, The Racist Dragon, ' ~
'into the very cold and very scary cave';
'into the very cold and very scary cave',
'...in the marmelade forest';
is $r.content[1],
'and it was so cold and so scary in there, that Albi began to cry';
is $r.content[2].content[0], "Dragon Tears!";
is $r.content[3], "Which, as we all know...";
is $r.content[4].content[0], "Turn into Jelly Beans!";
'and it was so cold and so scary in there, that Albi began to cry',
'...between the make-believe trees';
is $r.content[2].content[0], "Dragon Tears!",
'...in a cottage cheese cottage';
is $r.content[3], "Which, as we all know...",
'...lives Albi! Albi!';
is $r.content[4].content[0], "Turn into Jelly Beans!",
'...Albi, the Racist Dragon';

$x = q[
=begin pod
Expand All @@ -99,5 +104,7 @@ between these two paragraphs
];
$r = Pod6::parse($x);
isa_ok $r, Pod6::Block;
is $r.content[0], 'someone accidentally left a space';
is $r.content[1], 'between these two paragraphs';
is $r.content[0], 'someone accidentally left a space',
'accidental space, 1/2';
is $r.content[1], 'between these two paragraphs',
'accidental space, 2/2';
50 changes: 46 additions & 4 deletions t/02-paragraph.t
@@ -1,6 +1,6 @@
use Test;
use Pod6;
plan 15;
plan 22;

my $x = q[
=for foo
Expand Down Expand Up @@ -40,11 +40,14 @@ Outside blocks
];
$r = Pod6::parse($x);
isa_ok $r.content[0], Pod6::Block;
is $r.content[0].content[0], "Inside got";
is $r.content[0].content[0], "Inside got",
'paragraph block content ok, 1/2';
isa_ok $r.content[1], Pod6::Block;
is $r.content[1].content[0], "Inside bidden";
is $r.content[1].content[0], "Inside bidden",
'paragraph block content ok, 1/2';
isa_ok $r.content[2], Str;
is $r.content[2], "Outside blocks";
is $r.content[2], "Outside blocks",
'content outside blocks is all right';

# mixed blocks
$x = q[
Expand All @@ -68,3 +71,42 @@ is $r.content[0].content[0], "one, delimited block", "mixed blocks, 1";
is $r.content[1].content[0], "two, paragraph block", "mixed blocks, 2";
is $r.content[2].content[0], "three, still a parablock", "mixed blocks, 3";
is $r.content[3].content[0], "four, another delimited one", "mixed blocks, 4";

# tests without Albi would still be tests, but definitely very, very sad
# also, Albi without paragraph blocks wouldn't be the happiest dragon
# either
$x = q[
=begin foo
and so, all of the villages chased
Albi, The Racist Dragon, into the
very cold and very scary cave
and it was so cold and so scary in
there, that Albi began to cry
=for bar
Dragon Tears!
Which, as we all know...
=for bar
Turn into Jelly Beans!
=end foo
];

$r = Pod6::parse($x);
isa_ok $r, Pod6::Block;
is $r.content.elems, 5, '5 sub-nodes in foo';
is $r.content[0],
'and so, all of the villages chased Albi, The Racist Dragon, ' ~
'into the very cold and very scary cave',
'...in the marmelade forest';
is $r.content[1],
'and it was so cold and so scary in there, that Albi began to cry',
'...between the make-believe trees';
is $r.content[2].content[0], "Dragon Tears!",
'...in a cottage cheese cottage';
is $r.content[3], "Which, as we all know...",
'...lives Albi! Albi!';
is $r.content[4].content[0], "Turn into Jelly Beans!",
'...Albi, the Racist Dragon';

0 comments on commit b501e36

Please sign in to comment.