File: delete_empty_groups.t

package info (click to toggle)
libcpan-changes-perl 0.500005-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,964 kB
  • sloc: perl: 988; makefile: 2
file content (54 lines) | stat: -rw-r--r-- 861 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
53
54
use strict;
use warnings;

use Test::More;

use CPAN::Changes;

subtest basic => sub {
    plan tests => 2;

    my $changes = CPAN::Changes->load_string(<<'END_CHANGES');
0.2 2012-02-01
    [D]
    [E]
    - Yadah

0.1 2011-01-01
    [A]
    - Stuff
    [B]
    [C]
    - Blah
END_CHANGES

    $changes->delete_empty_groups;

    is_deeply( [ sort( ($changes->releases)[0]->groups ) ], [ qw/ A C / ] );
    is_deeply( [ sort( ($changes->releases)[1]->groups ) ], [ 'E' ] );
};

subtest mixed => sub {
    plan tests => 1;

    my $changes = CPAN::Changes->load_string(<<'END_CHANGES');
Revision history for {{$dist->name}}

0.2.0
    [BUGS FIXES]
    - A
    - B

0.1.0     2012-03-19
    - C
END_CHANGES

    $changes->delete_empty_groups;

    is_deeply( [ sort( ($changes->releases)[0]->changes ) ], [ {
        '' => [ 'C' ],
    } ] );

};

done_testing;