File: methodinfo.t

package info (click to toggle)
libtest-class-perl 0.52-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 540 kB
  • sloc: perl: 1,706; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 711 bytes parent folder | download
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
use strict;
use warnings;
use Test::More 'no_plan';
use constant CLASS => 'Test::Class::MethodInfo';
BEGIN { use_ok( CLASS) }

{
    isa_ok my $o = CLASS->new(name=> 'foo'), CLASS;
    ok $o->is_type('test'), 'method type is test by default';
    is $o->num_tests, 1, 'test methods default to 1 test';
}

__END__
{
    isa_ok my $o = CLASS->new(name=> 'foo', num_tests => 0), CLASS;
    is $o->num_tests, 0, 'test method can have zero tests';
}

{
    foreach my $type qw(setup teardown startup shutdown) {
        isa_ok my $o = CLASS->new(name=> 'foo', type=> $type), CLASS, $type;
        ok $o->is_type($type), "method type is $type";
        is $o->num_tests, 0, "$type methods default to 0 test";
    }
}