File: 02simple.t

package info (click to toggle)
libpod-coverage-perl 0.23-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 240 kB
  • sloc: perl: 611; makefile: 7
file content (90 lines) | stat: -rw-r--r-- 2,707 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/perl -w
use strict;
use Test::More tests => 36;
use lib 't/lib';

BEGIN {
    use_ok( 'Pod::Coverage' );
    use_ok( 'Pod::Coverage::ExportOnly' );
}

my $obj = new Pod::Coverage package => 'Simple1';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 2/3, "Simple1 has 2/3rds coverage");

$obj = new Pod::Coverage package => 'Simple2';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 0.75, "Simple2 has 75% coverage");

ok( eq_array([ $obj->naked ], [ 'naked' ]), "naked isn't covered");

ok( eq_array([ $obj->naked ], [ $obj->uncovered ]), "naked is uncovered");

$obj = new Pod::Coverage package => 'Simple2', private => [ 'naked' ];
isa_ok( $obj, 'Pod::Coverage' );

is ( $obj->coverage, 1, "nakedness is a private thing" );

$obj = new Pod::Coverage package => 'Simple1', also_private => [ 'bar' ];
isa_ok( $obj, 'Pod::Coverage' );

is ( $obj->coverage, 1, "it's also a private bar" );

ok( eq_array([ sort $obj->covered ], [ 'baz', 'foo' ]), "those guys are covered" );

$obj = new Pod::Coverage package => 'Pod::Coverage';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1, "Pod::Coverage is covered" );

$obj = new Pod::Coverage package => 'Simple3';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1, 'Simple3 is covered' );

$obj = new Pod::Coverage package => 'Simple4';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1, "External .pod grokked" );

$obj = new Pod::Coverage package => 'Simple5';
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1, "Multiple docs per item works" );

$obj = new Pod::Coverage package => "Simple6";
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1/3, "Simple6 is 2/3rds with no extra effort" );

$obj = new Pod::Coverage::ExportOnly package => "Simple6";
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage, 1/2, "Simple6 is 50% if you only check exports" );

$obj = new Pod::Coverage package => "Simple8";
isa_ok( $obj, 'Pod::Coverage' );

is( $obj->coverage,    undef, "can't deduce for Simple8" );
is( $obj->why_unrated, 'no public symbols defined', 'why is correct' );

$obj = Pod::Coverage->new(package => 'Simple9');
isa_ok($obj, 'Pod::Coverage');

is($obj->coverage, undef, 'Simple9 has no coverage');
is($obj->why_unrated, "requiring 'Simple9' failed", 'why is correct');

$obj = Pod::Coverage->new( package => 'Earle' );
is( $obj->coverage, 1, "earle is covered" );
is( scalar $obj->covered, 2 );

$obj = Pod::Coverage->new( package => 'Args' );
is( $obj->coverage, 1, "Args is covered" );

$obj = Pod::Coverage->new( package => 'XS4ALL' );
is( $obj->coverage, 1, "XS4ALL is covered" );

$obj = Pod::Coverage->new( package => 'Fully::Qualified' );
is( $obj->coverage, 1, "Fully::Qualified is covered" );