summaryrefslogtreecommitdiffstats
path: root/RPM4/t
diff options
context:
space:
mode:
authornanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c>2007-07-20 13:53:42 +0000
committernanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c>2007-07-20 13:53:42 +0000
commit336acecf89068c1007b33da09dc33e06903246f4 (patch)
tree15bebec9eb95670ad4758642e1cfa0a74fc0734f /RPM4/t
parent076a2f9e679207ec1f0e106ec86a8c044b6d5201 (diff)
downloadperl-RPM4-336acecf89068c1007b33da09dc33e06903246f4.tar
perl-RPM4-336acecf89068c1007b33da09dc33e06903246f4.tar.gz
perl-RPM4-336acecf89068c1007b33da09dc33e06903246f4.tar.bz2
perl-RPM4-336acecf89068c1007b33da09dc33e06903246f4.tar.xz
perl-RPM4-336acecf89068c1007b33da09dc33e06903246f4.zip
- add test for header->string()
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@136 971eb68f-4bfb-0310-8326-d2484c010a4c
Diffstat (limited to 'RPM4/t')
-rw-r--r--RPM4/t/02header.t16
1 files changed, 14 insertions, 2 deletions
diff --git a/RPM4/t/02header.t b/RPM4/t/02header.t
index 4ec5611..b6ff323 100644
--- a/RPM4/t/02header.t
+++ b/RPM4/t/02header.t
@@ -1,9 +1,10 @@
# $Id$
use strict;
-use Test::More tests => 42;
+use Test::More tests => 45;
use FindBin qw($Bin);
use RPM4;
+use File::Temp;
my $headerfile;
@@ -34,7 +35,6 @@ ok($hdr->removetag(1000) == 0, "Removing a tag");
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");
-ok($hdr->string, "can get header as string");
}
{
@@ -77,4 +77,16 @@ unlink($headerfile);
ok($hdr2->tag(1000) eq 'test-rpm', "tag 1000 from header file works");
}
+{
+my $hdr = RPM4::Header->new("$Bin/test-rpm-1.0-1mdk.noarch.rpm");
+foreach my $magic (0, 1) {
+my $string = $hdr->string($magic);
+ok($string, "can get header as string");
+my $hdl = File::Temp->new(UNLINK => 1);
+print $hdl $string;
+seek($hdl, 0, 0);
+my $hdr2 = RPM4::stream2header($hdl);
+isa_ok($hdr, "RPM4::Header", "can reparse header from a string");
+}
+}