Skip to content

Commit 42ed02c

Browse files
committed
Test Pod::Convenience::first-code-block
1 parent 6b25b8a commit 42ed02c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

t/pod-convenience.t

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@ use Test;
33
use lib 'lib';
44
use Pod::Convenience;
55

6-
plan 9;
6+
plan 10;
7+
8+
subtest {
9+
eval_dies_ok('use Pod::Convenience; first-code-block();', "pod argument required");
10+
eval_dies_ok('use Pod::Convenience; first-code-block("moo");', "array argument required");
11+
12+
is(first-code-block(["text"]), '', "non-code POD returns empty string");
13+
14+
my @code-blocks;
15+
@code-blocks.push(Pod::Block::Code.new(contents => ['my $first-block']));
16+
@code-blocks.push(Pod::Block::Code.new(contents => ['my @second-block']));
17+
18+
# XXX: why does this return the *second* block??
19+
is(first-code-block(@code-blocks), 'my @second-block', "first code block returned");
20+
}, "first-code-block";
721

822
subtest {
923
plan 7;

0 commit comments

Comments
 (0)