diff options
Diffstat (limited to 'RPM4/t/02header.t')
-rw-r--r-- | RPM4/t/02header.t | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/RPM4/t/02header.t b/RPM4/t/02header.t index 4ded92b..394c92e 100644 --- a/RPM4/t/02header.t +++ b/RPM4/t/02header.t @@ -10,30 +10,30 @@ use File::Temp; my $headerfile; { -my $hdr = RPM4::Header->new(); +my $hdr = RPM4::Header->new; isa_ok($hdr, "RPM4::Header", "Creating empty header works"); -ok(! defined $hdr->tag(1000), "empty tag return nothings"); +ok(! defined($hdr->tag(1000)), "empty tag return nothings"); } { my $hdr = RPM4::Header->new("$Bin/test-rpm-1.0-1mdk.src.rpm"); isa_ok($hdr, "RPM4::Header", "instanciating an header from a source rpm works"); -ok($hdr->hastag(1000) eq 1, "Has tag 1000 (NAME), yes"); -ok($hdr->hastag("NAME") eq 1, "Has 'NAME', yes"); -ok($hdr->hastag(1044) eq 0, "Has tag 1044 (SOURCERPM), yes"); -ok($hdr->listtag(), "can list tag"); +ok($hdr->hastag(1000) == 1, "Has tag 1000 (NAME), yes"); +ok($hdr->hastag("NAME") == 1, "Has 'NAME', yes"); +ok($hdr->hastag(1044) == 0, "Has tag 1044 (SOURCERPM), yes"); +ok($hdr->listtag, "can list tag"); is($hdr->tag(1000), "test-rpm", "accessing tag by id works"); is($hdr->tag("NAME"), "test-rpm", "accessing tag by name works"); is($hdr->tag("URL"), "http://rpm4.zarb.org/", "accessing tag by name works"); -is($hdr->NAME(), "test-rpm", "accessing tag directly works"); +is($hdr->NAME, "test-rpm", "accessing tag directly works"); ok($hdr->queryformat("%{NAME}-%{VERSION}-%{RELEASE}") eq "test-rpm-1.0-1mdk", "Queryformat is ok"); -ok($hdr->nevr() eq "test-rpm-1.0-1mdk", "header->nevr works"); +ok($hdr->nevr eq "test-rpm-1.0-1mdk", "header->nevr works"); ok(scalar($hdr->fullname) eq "test-rpm-1.0-1mdk.src", "scalar fullname works"); ok(join(",", $hdr->fullname) eq "test-rpm,1.0,1mdk,src", "wantarray fullname works"); ok($hdr->issrc == 1, "Is a src, Yes !"); ok($hdr->sourcerpmname eq "test-rpm-1.0-1mdk.src.rpm", "sourcerpmname works"); ok($hdr->removetag(1000) == 0, "Removing a tag"); -ok(! defined $hdr->tag(1000), "tag is not present"); +ok(!defined($hdr->tag(1000)), "tag is not present"); ok($hdr->addtag(1000, 6, "new name") == 1, "Adding a tag (string type)"); ok($hdr->tag(1000) eq "new name", "Added tag return good value"); } @@ -41,22 +41,22 @@ ok($hdr->tag(1000) eq "new name", "Added tag return good value"); { my $hdr = RPM4::Header->new("$Bin/test-rpm-1.0-1mdk.noarch.rpm"); isa_ok($hdr, "RPM4::Header", "instanciating an header from a binary rpm works"); -ok($hdr->hastag(1000) eq 1, "Has tag 1000 (NAME), yes"); -ok($hdr->tagtype(1000) eq RPM4::tagtypevalue("STRING"), "can get type of a tag"); -ok($hdr->hastag(1106) eq 0, "Has tag 1106 (SOURCEPACKAGE), no"); -ok($hdr->listtag(), "can list tag"); +ok($hdr->hastag(1000) == 1, "Has tag 1000 (NAME), yes"); +ok($hdr->tagtype(1000) == RPM4::tagtypevalue("STRING"), "can get type of a tag"); +ok($hdr->hastag(1106) == 0, "Has tag 1106 (SOURCEPACKAGE), no"); +ok($hdr->listtag, "can list tag"); is($hdr->tag(1000), "test-rpm", "accessing tag by id works"); is($hdr->tag("NAME"), "test-rpm", "accessing tag by name works"); -is($hdr->NAME(), "test-rpm", "accessing tag directly works"); +is($hdr->NAME, "test-rpm", "accessing tag directly works"); ok($hdr->queryformat("%{NAME}-%{VERSION}-%{RELEASE}") eq "test-rpm-1.0-1mdk", "Queryformat is ok"); ok(scalar($hdr->fullname) eq "test-rpm-1.0-1mdk.noarch", "scalar fullname works"); ok(join(",", $hdr->fullname) eq "test-rpm,1.0,1mdk,noarch", "wantarray fullname works"); ok($hdr->issrc == 0, "Is a src, No !"); ok($hdr->sourcerpmname eq "test-rpm-1.0-1mdk.src.rpm", "sourcerpmname works"); -$headerfile = scalar($hdr->fullname).".hdr"; +$headerfile = scalar($hdr->fullname) . ".hdr"; -my $hdrcopy = $hdr->copy(); +my $hdrcopy = $hdr->copy; ok(defined $hdrcopy, "copy works"); ok($hdrcopy->tag(1000) eq 'test-rpm', "tag 1000 (NAME) from copy works"); |