X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F101populate_rs.t;h=5686c3ec4f04a6531acdee0799f1d9bcd1063945;hb=277e30142fc9da75bd323bc6b21267aa32523287;hp=a592e56ebe5d82302bce88c4a93cc1fab4c84395;hpb=2a6dda4b4b591e4da531d6c78ff9dc9e359d5fd9;p=dbsrgits%2FDBIx-Class.git diff --git a/t/101populate_rs.t b/t/101populate_rs.t index a592e56..5686c3e 100644 --- a/t/101populate_rs.t +++ b/t/101populate_rs.t @@ -13,6 +13,7 @@ use warnings; use Test::More; use Test::Warn; +use Test::Exception; use lib qw(t/lib); use DBICTest; @@ -704,6 +705,26 @@ ARRAYREF_OF_ARRAYREF_STYLE: { } } -ok(eval { $art_rs->populate([]); 1 }, "Empty populate runs but does nothing"); +EMPTY_POPULATE: { + foreach( + [ empty => [] ], + [ columns_only => [ [qw(name rank charfield)] ] ], + ) { + my ($desc, $arg) = @{$_}; + + $schema->is_executed_sql_bind( sub { + + my $rs = $art_rs; + lives_ok { $rs->populate($arg); 1 } "$desc populate in void context lives"; + + my @r = $art_rs->populate($arg); + is_deeply( \@r, [], "$desc populate in list context returns empty list" ); + + my $r = $art_rs->populate($arg); + is( $r, undef, "$desc populate in scalar context returns undef" ); + + }, [], "$desc populate executed no statements" ); + } +} done_testing;