1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
use Test::Base;
plan tests => 1 + 1 * blocks;
filters { that => 'chomp' };
run_is this => 'that';
run sub {
my $block = shift;
my $value = $block->value or return;
is $value, 'this', $block->name;
};
my $bad_spec = <<'...';
===
--- bad: real content
bogus
stuff
--- xxx
yyy
...
my $tb = Test::Base->new->spec_string($bad_spec);
eval { $tb->blocks };
like "$@",
qr"Extra lines not allowed in 'bad' section",
'Bad spec fails';
sub upper { uc($_) }
__DATA__
=== Basic compact form
--- (this): there is foo
--- (that)
there is foo
=== Filters work
--- (this) upper: too high to die
--- (that)
TOO HIGH TO DIE
=== Can have no value
--- (this):
--- (that)
=== Can have ': ' in value
--- (this) : foo: bar
--- (that) chop
foo: bart
=== Test trailing blank lines are ok
--- (value): this
|