Added support for Epoch field. And tests for it.

This commit is contained in:
Dave Cross 2010-02-10 09:11:57 +00:00
parent 988fa070c7
commit 8594393315
3 changed files with 5 additions and 1 deletions

View file

@ -12,6 +12,7 @@ our $VERSION = '0.05';
has file => ( is => 'rw', isa => 'Str', required => 1 );
has name => ( is => 'rw', isa => 'Str' );
has version => ( is => 'rw', isa => 'Str' );
has epoch => ( is => 'rw', isa => 'Str' );
has release => ( is => 'rw', isa => 'Str' );
has summary => ( is => 'rw', isa => 'Str' );
has license => ( is => 'rw', isa => 'Str' );
@ -59,6 +60,7 @@ sub parse_file {
while (<$fh>) {
/^Name:\s*(\S+)/ and $self->{name} = $1;
/^Version:\s*(\S+)/ and $self->{version} = $1;
/^Epoch:\s*(\S+)/ and $self->{epoch} = $1;
/^Release:\s*(\S+)/ and $self->{release} = $1;
/^Summary:\s*(.+)/ and $self->{summary} = $1;
/^License:\s*(.+)/ and $self->{license} = $1;

View file

@ -1,5 +1,6 @@
Name: perl-Array-Compare
Version: 1.16
Epoch: 1
Release: 1%{?dist}
Summary: Perl extension for comparing arrays
License: GPL+ or Artistic

View file

@ -1,4 +1,4 @@
use Test::More tests => 10;
use Test::More tests => 11;
BEGIN { use_ok('Parse::RPM::Spec') };
ok($spec = Parse::RPM::Spec->new( { file => 't/file.spec' } ));
@ -6,6 +6,7 @@ isa_ok($spec, 'Parse::RPM::Spec');
is($spec->name, 'perl-Array-Compare');
is($spec->summary, 'Perl extension for comparing arrays');
is($spec->epoch, 1);
is($spec->version, '1.16');
$spec->version('1.17');