File: 02_kwalitee.t

package info (click to toggle)
libmodule-cpants-analyse-perl 0.86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 448 kB
  • sloc: perl: 1,781; sh: 48; makefile: 10
file content (52 lines) | stat: -rw-r--r-- 1,351 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use Test::More;
use Test::Deep;
use Test::NoWarnings;

use Module::CPANTS::Kwalitee;

my $CORE = 25;
my $OPTIONAL = 10; #is_extra set
my $EXTRA = 15; #experimental?
my $METRICS = $CORE + $OPTIONAL + $EXTRA;

plan tests => 8 + 2 * $METRICS;

my $k=Module::CPANTS::Kwalitee->new({});

is($k->available_kwalitee, $CORE, 'available kwalitee');
is($k->total_kwalitee, $CORE + $OPTIONAL, 'total kwalitee');


my $ind=$k->get_indicators_hash;
is(ref($ind),'HASH','indicator_hash');
is(ref($ind->{use_strict}),'HASH','hash element');

{
    my @all=$k->all_indicator_names;
    is(@all, $METRICS, 'number of all indicators');
}

{
    my @all=$k->core_indicator_names;
    is(@all, $CORE, 'number of core indicators');
}

{
    my @all=$k->optional_indicator_names;
    is(@all, $OPTIONAL,'number of optional indicators');
}


foreach my $mod (@{$k->generators}) {
    #$mod->analyse($me);
    foreach my $i (@{$mod->kwalitee_indicators}) {
        like $i->{name}, qr/^\w{3,}$/, $i->{name};
        # to check if someone has put a $var in single quotes by mistake...
        unlike $i->{error}, qr/\$[a-z]/, "error of $i->{name} has no \$ sign";
        # next if $i->{needs_db};
        # print $i->{name}."\n" if $me->opts->{verbose};
        # my $rv=$i->{code}($me->d, $i);
        # $me->d->{kwalitee}{$i->{name}}=$rv;
        # $kwalitee+=$rv;
    }
}