File: hookable_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 (15 lines) | stat: -rw-r--r-- 288 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Test::Roo;

has counter => ( is => 'rw', default => sub { 0 } );

sub is_positive {
    my $self = shift;
    ok( $self->counter > 0, "counter is positive" );
}

before is_positive => sub { shift->counter( 1 ) };

test 'hookable' => sub { shift->is_positive };

run_me;
done_testing;