X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbind%2Forder_by.t;h=f88473969599710404acbfbb6a3c877605252be6;hb=f3f6c13a8ed810cce53141b462f372140e2ab2cd;hp=7a8bce6f606123046a3cd2167af0a34f15cd0c18;hpb=22912b455e1116d0172ac9dea850304b82c96ac1;p=dbsrgits%2FDBIx-Class.git diff --git a/t/bind/order_by.t b/t/bind/order_by.t index 7a8bce6..f884739 100644 --- a/t/bind/order_by.t +++ b/t/bind/order_by.t @@ -3,6 +3,7 @@ use warnings; use Test::More; use Test::Exception; +use Data::Dumper::Concise; use lib qw(t/lib); use DBICTest; use DBIC::SqlMakerTest; @@ -25,7 +26,7 @@ sub test_order { { order_by => $args->{order_by}, having => - [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', 8 ] ] + [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', [ read_count => 8 ] ] ] } )->as_query, "( @@ -38,14 +39,13 @@ sub test_order { [ [qw(foo bar)], [qw(read_count 5)], - 8, + [qw(read_count 8)], $args->{bind} ? @{ $args->{bind} } : () ], - ); + ) || diag Dumper $args->{order_by}; }; - fail('Fail the unfinished is_same_sql_bind') if $@; } } @@ -61,46 +61,42 @@ my @tests = ( bind => [], }, { - order_by => { -desc => \[ 'colA LIKE ?', 'test' ] }, + order_by => { -desc => \[ 'colA LIKE ?', [ colA => 'test' ] ] }, order_req => 'colA LIKE ? DESC', - bind => [qw(test)], + bind => [ [ colA => 'test' ] ], }, { - order_by => \[ 'colA LIKE ? DESC', 'test' ], + order_by => \[ 'colA LIKE ? DESC', [ colA => 'test' ] ], order_req => 'colA LIKE ? DESC', - bind => [qw(test)], + bind => [ [ colA => 'test' ] ], }, { order_by => [ { -asc => \['colA'] }, - { -desc => \[ 'colB LIKE ?', 'test' ] }, - { -asc => \[ 'colC LIKE ?', 'tost' ] } + { -desc => \[ 'colB LIKE ?', [ colB => 'test' ] ] }, + { -asc => \[ 'colC LIKE ?', [ colC => 'tost' ] ] }, ], order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC', - bind => [qw(test tost)], + bind => [ [ colB => 'test' ], [ colC => 'tost' ] ], }, - - # (mo) this would be really really nice! - # (ribasushi) I don't think so, not writing it - patches welcome { + todo => 1, order_by => [ { -asc => 'colA' }, { -desc => { colB => { 'LIKE' => 'test' } } }, { -asc => { colC => { 'LIKE' => 'tost' } } } ], order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC', - bind => [ [ colB => 'test' ], [ colC => 'tost' ] ], # ??? - todo => 1, + bind => [ [ colB => 'test' ], [ colC => 'tost' ] ], }, { + todo => 1, order_by => { -desc => { colA => { LIKE => 'test' } } }, order_req => 'colA LIKE ? DESC', - bind => [qw(test)], - todo => 1, + bind => [ [ colA => 'test' ] ], }, ); -plan( tests => scalar @tests * 2 ); - test_order($_) for @tests; +done_testing;