File: read_preamble.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 (51 lines) | stat: -rw-r--r-- 1,223 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
use strict;
use warnings;

use Test::More;

use CPAN::Changes;

{
    my $changes = CPAN::Changes->load( 'corpus/test/legacy/preamble.changes' );

    isa_ok( $changes, 'CPAN::Changes' );
    is( $changes->preamble, 'Revision history for perl module Foo::Bar',
        'preamble' );

    check_releases( $changes );
}

{
    my $changes = CPAN::Changes->load( 'corpus/test/legacy/long_preamble.changes' );

    isa_ok( $changes, 'CPAN::Changes' );
    is( $changes->preamble, 'Revision history for perl module Foo::Bar

Yep.',
        'preamble' );

    check_releases( $changes );
}

sub check_releases {
    my $changes  = shift;
    my @releases = $changes->releases;

    is( scalar @releases, 1, 'has 1 release' );
    isa_ok( $releases[ 0 ], 'CPAN::Changes::Release' );
    is( $releases[ 0 ]->version, '0.01',       'version' );
    is( $releases[ 0 ]->date,    '2010-06-16', 'date' );
    is_deeply(
        $releases[ 0 ]->changes,
        { '' => [ 'Initial release' ] },
        'full changes'
    );
    is_deeply( [ $releases[ 0 ]->groups ], [ '' ], 'only the main group' );
    is_deeply(
        $releases[ 0 ]->changes( '' ),
        [ 'Initial release' ],
        'one change line'
    );
}

done_testing;