From: Peter Rabbitson Date: Sun, 24 May 2009 13:35:07 +0000 (+0000) Subject: Failing test about warnings triggered in SQLA::Limit when using a subquery X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a67b55787d209a60341f97061f0c0ad07c8f5e2;p=dbsrgits%2FDBIx-Class-Historic.git Failing test about warnings triggered in SQLA::Limit when using a subquery --- diff --git a/t/42toplimit.t b/t/42toplimit.t index 15df156..3c75e93 100644 --- a/t/42toplimit.t +++ b/t/42toplimit.t @@ -7,7 +7,7 @@ use lib qw(t/lib); use DBICTest; # do not remove even though it is not used use DBIC::SqlMakerTest; -plan tests => 8; +plan tests => 10; my $sa = new DBIx::Class::SQLAHacks; $sa->limit_dialect( 'Top' ); @@ -43,3 +43,17 @@ sub test_order { ], expected_sql_order => ['foo ASC, bar DESC, baz ASC, frew ASC', 'foo DESC, bar ASC, baz DESC, frew DESC'] }); + +{ + + my @w; + local $SIG{__WARN__} = sub { $_[0] =~ /Use of uninitialized value/ ? push @w, @_ : warn @_ }; + my $subquery = $sa->select( [{ subq => \['(SELECT * FROM foo)'] }], [qw{bar baz}], undef, undef, 1, 3); + is_same_sql( + $subquery, + "SELECT * FROM ( SELECT TOP 1 * FROM ( SELECT TOP 4 bar,baz FROM (SELECT * FROM foo) ) AS foo) AS bar", + ); + + is (@w, 0, 'No warnings on limit with subquery') + || diag join ("\n", @w); +}