r73224 - in /branches/upstream/libcpan-changes-perl/current: ./ lib/CPAN/ lib/CPAN/Changes/ lib/Test/CPAN/ t/ t/corpus/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sat Apr 23 16:15:04 UTC 2011


Author: gregoa
Date: Sat Apr 23 16:14:50 2011
New Revision: 73224

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=73224
Log:
[svn-upgrade] new version libcpan-changes-perl (0.17)

Added:
    branches/upstream/libcpan-changes-perl/current/t/corpus/dist-zilla_format.changes
    branches/upstream/libcpan-changes-perl/current/t/corpus/timestamp.changes
    branches/upstream/libcpan-changes-perl/current/t/delete_empty_groups.t
    branches/upstream/libcpan-changes-perl/current/t/read_dist-zilla.t
    branches/upstream/libcpan-changes-perl/current/t/read_timestamp.t
    branches/upstream/libcpan-changes-perl/current/t/sort_groups.t
Modified:
    branches/upstream/libcpan-changes-perl/current/Changes
    branches/upstream/libcpan-changes-perl/current/MANIFEST
    branches/upstream/libcpan-changes-perl/current/META.yml
    branches/upstream/libcpan-changes-perl/current/Makefile.PL
    branches/upstream/libcpan-changes-perl/current/README
    branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes.pm
    branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes/Release.pm
    branches/upstream/libcpan-changes-perl/current/lib/Test/CPAN/Changes.pm
    branches/upstream/libcpan-changes-perl/current/t/self.t

Modified: branches/upstream/libcpan-changes-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/Changes?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/Changes (original)
+++ branches/upstream/libcpan-changes-perl/current/Changes Sat Apr 23 16:14:50 2011
@@ -1,4 +1,53 @@
 Revision history for perl module CPAN::Changes
+
+0.17 2011-04-21
+
+  - Eliminate extra whitespace when release data is not defined (RT #67441)
+
+  - Require version.pm 0.79, which introduced the $LAX regexp (RT #67613)
+
+  - Add the option to sort groups (Yanick Champoux)
+
+0.16 2011-04-12
+
+  - Expose W3CDTF regex variable
+
+  - Allow whitespace in some dates
+
+  - Extract out valid W3CDTF portions from dates
+
+  - Requires perl 5.10
+
+0.15 2011-04-11
+
+  - Handle more date/time formats during parsing
+
+0.14 2011-04-11
+
+  - Add delete_empty_groups() to Changes.pm and Release.pm (Yanick Champoux) 
+
+0.13 2011-04-04
+
+  - Use version.pm's LAX regex for finding versions.
+
+0.12 2011-04-04
+
+  - Sort releases() by version first for greater consistency
+
+0.11 2011-03-31
+
+  - Parse the default Dist-Zilla date format (e.g. 2010-12-28 00:15:12 
+    Europe/London)
+
+0.10 2011-03-29
+
+  - Be more strict about date validation in Test::CPAN::Changes
+
+0.09 2011-03-29
+
+  - Be more lenient when parsing dates. Timestamps (e.g. 
+    Tue Mar 29 08:32:16 2011) are now parsed and converted to W3CDTF. (Fixes 
+    RT #66862)
 
 0.08 2011-03-14
 

Modified: branches/upstream/libcpan-changes-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/MANIFEST?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/MANIFEST (original)
+++ branches/upstream/libcpan-changes-perl/current/MANIFEST Sat Apr 23 16:14:50 2011
@@ -19,6 +19,7 @@
 t/corpus/basic.changes
 t/corpus/different-indentation.changes
 t/corpus/dist-zilla.changes
+t/corpus/dist-zilla_format.changes
 t/corpus/group-brackets.changes
 t/corpus/group.changes
 t/corpus/line-continuation.changes
@@ -26,9 +27,12 @@
 t/corpus/no-leading-space-for-change.changes
 t/corpus/preamble.changes
 t/corpus/space-before-date.changes
+t/corpus/timestamp.changes
+t/delete_empty_groups.t
 t/dist-zilla-changes.t
 t/read_basic.t
 t/read_different-indentation.t
+t/read_dist-zilla.t
 t/read_group-brackets.t
 t/read_group.t
 t/read_line-continuation.t
@@ -36,7 +40,9 @@
 t/read_no-leading-space-for-change.t
 t/read_preamble.t
 t/read_space-before-date.t
+t/read_timestamp.t
 t/self.t
 t/serialize.t
+t/sort_groups.t
 xt/release/pod.t
 xt/release/pod_coverage.t

Modified: branches/upstream/libcpan-changes-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/META.yml?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/META.yml (original)
+++ branches/upstream/libcpan-changes-perl/current/META.yml Sat Apr 23 16:14:50 2011
@@ -21,9 +21,9 @@
     - xt
 requires:
   Text::Wrap: 0
-  perl: 5.8.0
-  version: 0
+  perl: 5.10.0
+  version: 0.79
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/bricas/cpan-changes
-version: 0.08
+version: 0.17

Modified: branches/upstream/libcpan-changes-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/Makefile.PL?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/Makefile.PL (original)
+++ branches/upstream/libcpan-changes-perl/current/Makefile.PL Sat Apr 23 16:14:50 2011
@@ -4,13 +4,13 @@
     system( 'pod2text lib/CPAN/Changes.pm > README' );
 }
 
-perl_version '5.008';
+perl_version '5.010';
 
 name 'CPAN-Changes';
 all_from 'lib/CPAN/Changes.pm';
 
 requires 'Text::Wrap';
-requires 'version';
+requires 'version' => '0.79';
 
 test_requires 'Test::More';
 extra_tests;

Modified: branches/upstream/libcpan-changes-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/README?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/README (original)
+++ branches/upstream/libcpan-changes-perl/current/README Sat Apr 23 16:14:50 2011
@@ -77,9 +77,15 @@
     Returns the release object for the specified version. Should there be no
     matching release object, undef is returned.
 
-  serialize( )
+  serialize( group_sort => \&sorting_function )
     Returns all of the data as a string, suitable for saving as a Changes
     file.
+
+    If *group_sort* is provided, change groups are sorted according to the
+    given function. If not, groups are sorted alphabetically.
+
+  delete_empty_groups( )
+    Deletes change groups without changes in all releases.
 
 DEALING WITH "NEXT VERSION" PLACEHOLDERS
     In the working copy of a distribution, it's not uncommon to have a "next

Modified: branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes.pm?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes.pm (original)
+++ branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes.pm Sat Apr 23 16:14:50 2011
@@ -8,13 +8,32 @@
 use Scalar::Util ();
 use version      ();
 
-our $VERSION = '0.08';
+our $VERSION = '0.17';
+
+# From DateTime::Format::W3CDTF
+our $W3CDTF_REGEX = qr{(\d\d\d\d) # Year
+                 (?:-(\d\d) # -Month
+                 (?:-(\d\d) # -Day
+                 (?:T
+                   (\d\d):(\d\d) # Hour:Minute
+                   (?:
+                     :(\d\d)     # :Second
+                     (\.\d+)?    # .Fractional_Second
+                   )?
+                   ( Z          # UTC
+                   | [+-]\d\d:\d\d    # Hour:Minute TZ offset
+                     (?::\d\d)?       # :Second TZ offset
+                 )?)?)?)?}x;
+
+my @m = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
+my %months = map { $m[ $_ ] => $_ + 1 } 0 .. 11;
 
 sub new {
     my $class = shift;
     return bless {
         preamble => '',
         releases => {},
+        months   => \%months,
         @_,
     }, $class;
 }
@@ -41,8 +60,8 @@
 
     my $version_line_re
         = $changes->{ next_token }
-        ? qr/^(?:[v0-9]|$changes->{next_token})/
-        : qr/^[v0-9]/;
+        ? qr/^(?:$version::LAX|$changes->{next_token})/
+        : qr/^$version::LAX/;
 
     $preamble .= shift @lines while @lines && $lines[ 0 ] !~ $version_line_re;
 
@@ -50,9 +69,55 @@
 
         # Version & Date
         if ( $l =~ $version_line_re ) {
-
-            # currently ignores data after the date; could be useful later
-            my ( $v, $d ) = split m{\s+}, $l;
+            my ( $v, $d ) = split m{\s+}, $l, 2;
+
+            # munge date formats, ignore junk
+            if ( $d ) {
+
+                # handle localtime-like timestamps
+                if ( $d
+                    =~ m{\D{3}\s+(\D{3})\s+(\d{1,2})\s+([\d:]+)?\D*(\d{4})} )
+                {
+                    if ( $3 ) {
+
+                        # unfortunately ignores TZ data
+                        $d = sprintf(
+                            '%d-%02d-%02dT%sZ',
+                            $4, $changes->{ months }->{ $1 },
+                            $2, $3
+                        );
+                    }
+                    else {
+                        $d = sprintf( '%d-%02d-%02d',
+                            $4, $changes->{ months }->{ $1 }, $2 );
+                    }
+                }
+
+                # RFC 2822
+                elsif ( $d
+                    =~ m{\D{3}, (\d{1,2}) (\D{3}) (\d{4}) (\d\d:\d\d:\d\d) ([+-])(\d{2})(\d{2})}
+                    )
+                {
+                    $d = sprintf(
+                        '%d-%02d-%02dT%s%s%02d:%02d',
+                        $3, $changes->{ months }->{ $2 },
+                        $1, $4, $5, $6, $7
+                    );
+                }
+
+                # handle dist-zilla style, again ingoring TZ data
+                elsif ( $d
+                    =~ m{(\d{4}-\d\d-\d\d)\s+(\d\d:\d\d(?::\d\d)?)(\s+\D+)?} )
+                {
+                    $d = sprintf( '%sT%sZ', $1, $2 );
+                }
+
+                # start with W3CDTF, ignore rest
+                elsif ( $d =~ m{^($W3CDTF_REGEX)}p ) {
+                    $d = ${^MATCH};
+                }
+            }
+
             push @releases,
                 CPAN::Changes::Release->new(
                 version => $v,
@@ -84,7 +149,7 @@
         $l =~ s{^$indent}{};
 
         # Inconsistent indentation between releases
-        if( $l =~ m{^\s} && !@{ $releases[ -1 ]->changes( $ingroup ) } ) {
+        if ( $l =~ m{^\s} && !@{ $releases[ -1 ]->changes( $ingroup ) } ) {
             $l =~ m{^(\s+)};
             $indent = $1;
             $l =~ s{^\s+}{};
@@ -132,9 +197,9 @@
     }
 
     my $sort_function = sub {
-        ( $a->date || '' ) cmp( $b->date || '' )
-            or ( eval { version->parse( $a->version ) } || 0 )
-            <=> ( eval { version->parse( $b->version ) } || 0 );
+        ( eval { version->parse( $a->version ) } || 0 )
+            <=> ( eval { version->parse( $b->version ) } || 0 )
+            or ( $a->date || '' ) cmp( $b->date || '' );
     };
 
     my $next_token = $self->{ next_token };
@@ -172,13 +237,24 @@
     return $self->{ releases }->{ $version };
 }
 
+sub delete_empty_groups {
+    my $self = shift;
+
+    $_->delete_empty_groups for $self->releases;
+}
+
 sub serialize {
     my $self = shift;
+    my %args = @_;
+
+    my %release_args;
+    $release_args{ group_sort } = $args{ group_sort } if $args{ group_sort };
 
     my $output;
 
     $output = $self->preamble . "\n\n" if $self->preamble;
-    $output .= join( "\n", $_->serialize ) for reverse $self->releases;
+    $output .= join "\n", $_->serialize( %release_args )
+        for reverse $self->releases;
 
     return $output;
 }
@@ -284,10 +360,18 @@
 Returns the release object for the specified version. Should there be no 
 matching release object, undef is returned.
 
-=head2 serialize( )
+=head2 serialize( group_sort => \&sorting_function )
 
 Returns all of the data as a string, suitable for saving as a Changes 
 file.
+
+If I<group_sort> is provided, change groups are
+sorted according to the given function. If not,
+groups are sorted alphabetically.
+
+=head2 delete_empty_groups( )
+
+Deletes change groups without changes in all releases.
 
 =head1 DEALING WITH "NEXT VERSION" PLACEHOLDERS
 

Modified: branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes/Release.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes/Release.pm?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes/Release.pm (original)
+++ branches/upstream/libcpan-changes-perl/current/lib/CPAN/Changes/Release.pm Sat Apr 23 16:14:50 2011
@@ -76,7 +76,11 @@
 
 sub groups {
     my $self = shift;
-    return sort keys %{ $self->{ changes } };
+    my %args = @_;
+
+    $args{ sort } ||= sub { sort @_ };
+
+    return $args{ sort }->( keys %{ $self->{ changes } } );
 }
 
 sub add_group {
@@ -93,13 +97,22 @@
     delete $self->{ changes }->{ $_ } for @groups;
 }
 
+sub delete_empty_groups {
+    my $self = shift;
+
+    $self->delete_group( grep { !@{ $self->changes( $_ ) } } $self->groups );
+}
+
 sub serialize {
     my $self = shift;
-
-    my $output = sprintf "%s %s\n", $self->version, $self->date;
-
-    $output
-        .= join( "\n", map { $self->_serialize_group( $_ ) } $self->groups );
+    my %args = @_;
+
+    my $output = join( ' ', grep { defined } ( $self->version, $self->date ) )
+        . "\n";
+
+    $output .= join "\n",
+        map { $self->_serialize_group( $_ ) }
+        $self->groups( sort => $args{ group_sort } );
     $output .= "\n";
 
     return $output;
@@ -185,10 +198,14 @@
 
 Clears all changes from the release.
 
-=head2 groups( )
+=head2 groups( sort => \&sorting_function )
 
 Returns a list of current groups in this release.
 
+If I<sort> is provided, groups are
+sorted according to the given function. If not,
+they are sorted alphabetically.
+
 =head2 add_group( @groups )
 
 Creates an empty group under the names provided.
@@ -197,11 +214,19 @@
 
 Deletes the groups of changes specified.
 
-=head2 serialize( )
+=head2 delete_empty_groups( )
+
+Deletes all groups that don't contain any changes.
+
+=head2 serialize( group_sort => \&sorting_function )
 
 Returns the release data as a string, suitable for inclusion in a Changes 
 file.
 
+If I<group_sort> is provided, change groups are
+sorted according to the given function. If not,
+groups are sorted alphabetically.
+
 =head1 SEE ALSO
 
 =over 4

Modified: branches/upstream/libcpan-changes-perl/current/lib/Test/CPAN/Changes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/lib/Test/CPAN/Changes.pm?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/lib/Test/CPAN/Changes.pm (original)
+++ branches/upstream/libcpan-changes-perl/current/lib/Test/CPAN/Changes.pm Sat Apr 23 16:14:50 2011
@@ -7,7 +7,6 @@
 use Test::Builder;
 
 my $Test       = Test::Builder->new;
-my $date_re    = '^\d{4}-\d{2}-\d{2}';    # "Looks like" a W3CDTF
 my $version_re = '^[._\-[:alnum:]]+$';    # "Looks like" a version
 
 sub import {
@@ -51,7 +50,7 @@
     $Test->ok( 1, "$file contains at least one release" );
 
     for ( @releases ) {
-        if ( $_->date !~ m{$date_re} ) {
+        if ( $_->date !~ m{^${CPAN::Changes::W3CDTF_REGEX}\s*$} ) {
             $Test->ok( 0, "$file contains an invalid release date" );
             $Test->diag( '  ERR: ' . $_->date );
             return;

Added: branches/upstream/libcpan-changes-perl/current/t/corpus/dist-zilla_format.changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/corpus/dist-zilla_format.changes?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/corpus/dist-zilla_format.changes (added)
+++ branches/upstream/libcpan-changes-perl/current/t/corpus/dist-zilla_format.changes Sat Apr 23 16:14:50 2011
@@ -1,0 +1,2 @@
+0.01 2010-12-28 00:15:12 Europe/London
+ - Initial release

Added: branches/upstream/libcpan-changes-perl/current/t/corpus/timestamp.changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/corpus/timestamp.changes?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/corpus/timestamp.changes (added)
+++ branches/upstream/libcpan-changes-perl/current/t/corpus/timestamp.changes Sat Apr 23 16:14:50 2011
@@ -1,0 +1,20 @@
+0.07 2011-04-12T12:00:00Z # JUNK!
+ - W3CDTF, with junk marker
+
+0.06 Mon, 11 Apr 2011 21:40:45 -0300
+ - RFC 2822
+
+0.05 2011-04-11 15:14
+ - Similar to 0.04, without seconds
+
+0.04 2011-04-11 12:11:10
+ - Datetime w/o T or Z
+
+0.03 Fri Mar 25 2011
+ - Yet another release
+
+0.02 Fri Mar 25 12:18:36 2011
+ - Another release
+
+0.01 Fri Mar 25 12:16:25 ADT 2011
+ - Initial release

Added: branches/upstream/libcpan-changes-perl/current/t/delete_empty_groups.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/delete_empty_groups.t?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/delete_empty_groups.t (added)
+++ branches/upstream/libcpan-changes-perl/current/t/delete_empty_groups.t Sat Apr 23 16:14:50 2011
@@ -1,0 +1,27 @@
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use CPAN::Changes;
+
+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' ] );
+
+

Added: branches/upstream/libcpan-changes-perl/current/t/read_dist-zilla.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/read_dist-zilla.t?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/read_dist-zilla.t (added)
+++ branches/upstream/libcpan-changes-perl/current/t/read_dist-zilla.t Sat Apr 23 16:14:50 2011
@@ -1,0 +1,16 @@
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+
+use_ok( 'CPAN::Changes' );
+
+my $changes = CPAN::Changes->load( 't/corpus/dist-zilla_format.changes' );
+
+isa_ok( $changes, 'CPAN::Changes' );
+
+my @releases = $changes->releases;
+is( scalar @releases, 1, 'has 1 release' );
+
+isa_ok( $releases[ 0 ], 'CPAN::Changes::Release' );
+is( $releases[ 0 ]->date, '2010-12-28T00:15:12Z', 'date' );

Added: branches/upstream/libcpan-changes-perl/current/t/read_timestamp.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/read_timestamp.t?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/read_timestamp.t (added)
+++ branches/upstream/libcpan-changes-perl/current/t/read_timestamp.t Sat Apr 23 16:14:50 2011
@@ -1,0 +1,19 @@
+use strict;
+use warnings;
+
+use Test::More tests => 17;
+
+use_ok( 'CPAN::Changes' );
+
+my $changes = CPAN::Changes->load( 't/corpus/timestamp.changes' );
+
+isa_ok( $changes, 'CPAN::Changes' );
+
+my @releases = $changes->releases;
+is( scalar @releases, 7, 'has 7 releases' );
+
+my @expected = qw( 2011-03-25T12:16:25Z 2011-03-25T12:18:36Z 2011-03-25 2011-04-11T12:11:10Z 2011-04-11T15:14Z 2011-04-11T21:40:45-03:00 2011-04-12T12:00:00Z );
+for ( 0.. at expected - 1 ) {
+    isa_ok( $releases[ $_ ], 'CPAN::Changes::Release' );
+    is( $releases[ $_ ]->date,  $expected[ $_ ], 'date' );
+}

Modified: branches/upstream/libcpan-changes-perl/current/t/self.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/self.t?rev=73224&op=diff
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/self.t (original)
+++ branches/upstream/libcpan-changes-perl/current/t/self.t Sat Apr 23 16:14:50 2011
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 11;
+use Test::More tests => 20;
 
 use_ok( 'CPAN::Changes' );
 

Added: branches/upstream/libcpan-changes-perl/current/t/sort_groups.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcpan-changes-perl/current/t/sort_groups.t?rev=73224&op=file
==============================================================================
--- branches/upstream/libcpan-changes-perl/current/t/sort_groups.t (added)
+++ branches/upstream/libcpan-changes-perl/current/t/sort_groups.t Sat Apr 23 16:14:50 2011
@@ -1,0 +1,39 @@
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+use CPAN::Changes;
+
+my $changes = CPAN::Changes->load_string(<<'END_CHANGES');
+2011-04-17 1.05
+    [A]
+    - stuff
+    [B]
+    - mo' stuff
+2011-04-16 1.04
+    [C]
+    - stuff
+    [D]
+    - mo' stuff
+END_CHANGES
+
+like $changes->serialize => expected_order(qw/ A B C D/ );
+like $changes->serialize( group_sort => \&reverse_order ) => expected_order(qw/ B A D C/ );
+
+my ($release) = reverse $changes->releases;
+like $release->serialize => expected_order(qw/ A B / );
+like $release->serialize( group_sort => \&reverse_order ) => expected_order(qw/ B A / );
+
+is_deeply [ $release->groups ], [qw/ A B /]; 
+is_deeply [ $release->groups( sort => \&reverse_order ) ], [qw/ B A /]; 
+
+sub reverse_order {
+    return reverse sort @_;
+}
+
+sub expected_order {
+    my @groups = @_;
+    my $re = join '.*', map { "\\[$_\\]" } @groups;
+    return qr/$re/s;
+}




More information about the Pkg-perl-cvs-commits mailing list