~ubuntu-branches/ubuntu/trusty/libtest-roo-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/each_test.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-01-14 19:25:11 UTC
  • Revision ID: package-import@ubuntu.com-20140114192511-9ycl4dc1zgamfnek
Tags: upstream-1.002
ImportĀ upstreamĀ versionĀ 1.002

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use Test::Roo;
 
2
 
 
3
use lib 't/lib';
 
4
 
 
5
with 'EachTest';
 
6
 
 
7
sub _build_counter { return 0 }
 
8
 
 
9
before each_test => sub {
 
10
    my $self = shift;
 
11
    pass("starting before main modifier");
 
12
    $self->counter( $self->counter + 1 );
 
13
};
 
14
 
 
15
after each_test => sub {
 
16
    my $self = shift;
 
17
    $self->counter( $self->counter - 1 );
 
18
    pass("finishing after main modifier");
 
19
};
 
20
 
 
21
test 'is two' => sub { is( shift->counter, 2, "counter is 2" ) };
 
22
 
 
23
test 'still two' => sub { is( shift->counter, 2, "counter is still 2" ) };
 
24
 
 
25
run_me;
 
26
done_testing;