aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-06 13:45:25 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-06 13:45:25 +0000
commit0de5c7e0bfc780c5b5cf58c59f03a298b2053401 (patch)
tree90a0d706e98965db040aed5b1b9c6cc36f7257d1
parent91dcd39ee38e082a2d1343e632c5de1165958e7e (diff)
downloadperl-URPM-0de5c7e0bfc780c5b5cf58c59f03a298b2053401.tar
perl-URPM-0de5c7e0bfc780c5b5cf58c59f03a298b2053401.tar.gz
perl-URPM-0de5c7e0bfc780c5b5cf58c59f03a298b2053401.tar.bz2
perl-URPM-0de5c7e0bfc780c5b5cf58c59f03a298b2053401.tar.xz
perl-URPM-0de5c7e0bfc780c5b5cf58c59f03a298b2053401.zip
Be more Test::More-ish, add a TODO test
-rw-r--r--t/parse.t33
1 files changed, 19 insertions, 14 deletions
diff --git a/t/parse.t b/t/parse.t
index 29a6386..61d8bfe 100644
--- a/t/parse.t
+++ b/t/parse.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 28;
+use Test::More tests => 29;
use MDV::Packdrakeng;
use URPM;
use URPM::Build;
@@ -24,10 +24,14 @@ my $pkg = $a->{depslist}[0];
ok($pkg);
my %tags = $a->list_rpm_tag;
ok(keys %tags);
-ok($pkg->get_tag(1000) eq 'test-rpm');
-ok($pkg->get_tag(1001) eq '1.0');
-ok($pkg->get_tag(1002) eq '1mdk');
-# ok($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}") eq "test-rpm-1.0-1mdk.noarch");
+is($pkg->get_tag(1000), 'test-rpm', 'name');
+is($pkg->get_tag(1001), '1.0', 'version');
+is($pkg->get_tag(1002), '1mdk', 'release');
+TODO: {
+ local $TODO = "not implemented";
+ is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch",
+ q/get headers from parsing rpm/);
+}
$a->build_hdlist(
start => 0,
@@ -43,10 +47,11 @@ my $b = new URPM;
ok(@{$b->{depslist}} == 1);
$pkg = $b->{depslist}[0];
ok($pkg);
-ok($pkg->get_tag(1000) eq 'test-rpm');
-ok($pkg->get_tag(1001) eq '1.0');
-ok($pkg->get_tag(1002) eq '1mdk');
-ok($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}") eq "test-rpm-1.0-1mdk.noarch");
+is($pkg->get_tag(1000), 'test-rpm', 'name');
+is($pkg->get_tag(1001), '1.0', 'version');
+is($pkg->get_tag(1002), '1mdk', 'release');
+is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch",
+ q/get headers from hdlist/);
# Version comparison
ok(URPM::rpmvercmp("1-1mdk", "1-1mdk") == 0, "Same value = 0");
@@ -59,17 +64,17 @@ ok(URPM::rpmvercmp("1:1-1mdk", "2:1-1mdk") == -1, "epoch 1 vs 2 = -1");
open(my $hdfh, "zcat hdlist.cz 2>/dev/null |") or die $!;
my $pkg = URPM::stream2header($hdfh);
ok(defined $pkg, "Reading a header works");
- ok($pkg->get_tag(1000) eq 'test-rpm');
- ok($pkg->get_tag(1001) eq '1.0');
- ok($pkg->get_tag(1002) eq '1mdk');
- ok($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}") eq "test-rpm-1.0-1mdk.noarch");
+ is($pkg->get_tag(1000), 'test-rpm');
+ is($pkg->get_tag(1001), '1.0');
+ is($pkg->get_tag(1002), '1mdk');
+ is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch");
close $hdfh;
}
{
my $pkg = URPM::spec2srcheader("test-rpm.spec");
ok(defined $pkg, "Parsing a spec works");
- ok($pkg->get_tag(1000) eq 'test-rpm', 'parsed correctly');
+ is($pkg->get_tag(1000), 'test-rpm', 'parsed correctly');
$pkg = URPM::spec2srcheader("doesnotexist.spec");
ok(!defined $pkg, "non-existent spec");
open my $f, '>', 'bad.spec' or die "Can't write bad.spec: $!\n";