X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcdbi-t%2F21-iterator.t;h=d5244236bbcdab175990f6d52e3bef7fe0b01775;hb=e60dc79fcd4d6318e83584b826526e65048b86a9;hp=3c84f4c8903ed0cb0f3c855da626d266a4e116cc;hpb=05e8dc0a4848cd094c2aa063d183500017421fcc;p=dbsrgits%2FDBIx-Class.git diff --git a/t/cdbi-t/21-iterator.t b/t/cdbi-t/21-iterator.t index 3c84f4c..d524423 100644 --- a/t/cdbi-t/21-iterator.t +++ b/t/cdbi-t/21-iterator.t @@ -4,11 +4,11 @@ use Test::More; BEGIN { eval "use DBIx::Class::CDBICompat;"; if ($@) { - plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required'); + plan (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@"); next; } eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 33); + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 37); } use lib 't/testlib'; @@ -49,8 +49,6 @@ my @film = ( is $it->next->title, "Film 2", "And 2 is still next"; } -SKIP: { - #skip "Iterator doesn't yet have slice support", 19; { my $it = Film->retrieve_all; @@ -85,4 +83,14 @@ SKIP: { is $it->next->title, "Film 2", "And 2 is still next"; } -} # End SKIP +{ + my $it = Film->retrieve_all; + is $it, $it->count, "iterator returns count as a scalar"; + ok $it, "iterator returns true when there are results"; +} + +{ + my $it = Film->search( Title => "something which does not exist" ); + is $it, 0; + ok !$it, "iterator returns false when no results"; +}