Permalink
Browse files

add parsed 02packages data to pause tester results

...and use it
  • Loading branch information...
1 parent 5c8b135 commit b012dd4bae897a88ea75118453cff34e2c0468b2 @rjbs rjbs committed Aug 13, 2011
Showing with 33 additions and 10 deletions.
  1. +9 −0 t/lib/PAUSE/TestPAUSE/Result.pm
  2. +24 −10 t/mldistwatch.t
View
9 t/lib/PAUSE/TestPAUSE/Result.pm
@@ -3,6 +3,7 @@ use Moose;
use MooseX::StrictConstructor;
use DBI;
+use Parse::CPAN::Packages;
use Path::Class;
use namespace::autoclean;
@@ -50,4 +51,12 @@ sub connect_mod_db {
return $self->__connect( $self->mod_db_file );
}
+sub packages_data {
+ my ($self) = @_;
+
+ return Parse::CPAN::Packages->new(
+ q{} . $self->tmpdir->file(qw(cpan modules 02packages.details.txt.gz)),
+ );
+}
+
1;
View
34 t/mldistwatch.t
@@ -19,22 +19,36 @@ ok(
"our indexer indexed",
);
-my $pkg_rows = $result->connect_mod_db->selectall_arrayref(
- 'SELECT * FROM packages ORDER BY package, version',
- { Slice => {} },
-);
-
my @want = (
{ package => 'Bug::Gold', version => '9.001' },
{ package => 'Hall::MtKing', version => '0.01' },
{ package => 'XForm::Rollout', version => '1.00' },
{ package => 'Y', version => 2 },
);
-cmp_deeply(
- $pkg_rows,
- [ map {; superhashof($_) } @want ],
- "we indexed exactly the dists we expected to",
-);
+subtest "tests with the data in the modules db" => sub {
+ my $pkg_rows = $result->connect_mod_db->selectall_arrayref(
+ 'SELECT * FROM packages ORDER BY package, version',
+ { Slice => {} },
+ );
+
+ cmp_deeply(
+ $pkg_rows,
+ [ map {; superhashof($_) } @want ],
+ "we db-inserted exactly the dists we expected to",
+ );
+};
+
+subtest "tests with the parsed 02packages data" => sub {
+ my $p = $result->packages_data;
+
+ my @packages = sort { $a->package cmp $b->package } $p->packages;
+
+ cmp_deeply(
+ \@packages,
+ [ map {; methods(%$_) } @want ],
+ "we built exactly the 02packages we expected",
+ );
+};
done_testing;

0 comments on commit b012dd4

Please sign in to comment.