File: methodinfo.t

package info (click to toggle)
libtest-class-perl 0.35-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 476 kB
  • ctags: 102
  • sloc: perl: 1,668; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (6)
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
#! /usr/bin/perl

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";
    };
};