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