File: each_test.t

package info (click to toggle)
libtest-roo-perl 1.004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 522; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (3)
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
use Test::Roo;

use lib 't/lib';

with 'EachTest';

sub _build_counter { return 0 }

before each_test => sub {
    my $self = shift;
    pass("starting before main modifier");
    $self->counter( $self->counter + 1 );
};

after each_test => sub {
    my $self = shift;
    $self->counter( $self->counter - 1 );
    pass("finishing after main modifier");
};

test 'is two' => sub { is( shift->counter, 2, "counter is 2" ) };

test 'still two' => sub { is( shift->counter, 2, "counter is still 2" ) };

run_me;
done_testing;