[Bast-commits] r9465 - in DBIx-Class/0.08/trunk/t: bind search

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun May 30 22:37:20 GMT 2010


Author: ribasushi
Date: 2010-05-30 23:37:20 +0100 (Sun, 30 May 2010)
New Revision: 9465

Modified:
   DBIx-Class/0.08/trunk/t/bind/order_by.t
   DBIx-Class/0.08/trunk/t/search/subquery.t
Log:
Fix tests to survive the new SQLA bindtype checks

Modified: DBIx-Class/0.08/trunk/t/bind/order_by.t
===================================================================
--- DBIx-Class/0.08/trunk/t/bind/order_by.t	2010-05-30 22:36:33 UTC (rev 9464)
+++ DBIx-Class/0.08/trunk/t/bind/order_by.t	2010-05-30 22:37:20 UTC (rev 9465)
@@ -3,6 +3,7 @@
 
 use Test::More;
 use Test::Exception;
+use Data::Dumper::Concise;
 use lib qw(t/lib);
 use DBICTest;
 use DBIC::SqlMakerTest;
@@ -25,7 +26,7 @@
             {
                 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 @@
         [
             [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 @@
         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;

Modified: DBIx-Class/0.08/trunk/t/search/subquery.t
===================================================================
--- DBIx-Class/0.08/trunk/t/search/subquery.t	2010-05-30 22:36:33 UTC (rev 9464)
+++ DBIx-Class/0.08/trunk/t/search/subquery.t	2010-05-30 22:37:20 UTC (rev 9465)
@@ -16,12 +16,12 @@
 my @tests = (
   {
     rs => $cdrs,
-    search => \[ "title = ? AND year LIKE ?", 'buahaha', '20%' ],
+    search => \[ "title = ? AND year LIKE ?", [ title => 'buahaha' ], [ year => '20%' ] ],
     attrs => { rows => 5 },
     sqlbind => \[
       "( SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me WHERE (title = ? AND year LIKE ?) LIMIT 5)",
-      'buahaha',
-      '20%',
+      [ title => 'buahaha' ],
+      [ year => '20%' ],
     ],
   },
 
@@ -157,8 +157,6 @@
 );
 
 
-plan tests => @tests * 2;
-
 for my $i (0 .. $#tests) {
   my $t = $tests[$i];
   for my $p (1, 2) {  # repeat everything twice, make sure we do not clobber search arguments
@@ -169,3 +167,5 @@
     );
   }
 }
+
+done_testing;




More information about the Bast-commits mailing list