File: compact.t

package info (click to toggle)
libtest-base-perl 0.59-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 656 kB
  • ctags: 203
  • sloc: perl: 2,014; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (5)
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