[Bast-commits] r8413 - in DBIx-Class/0.08: branches/chaining_fixes/t trunk/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Fri Jan 22 10:35:15 GMT 2010


Author: ribasushi
Date: 2010-01-22 10:35:15 +0000 (Fri, 22 Jan 2010)
New Revision: 8413

Modified:
   DBIx-Class/0.08/branches/chaining_fixes/t/88result_set_column.t
   DBIx-Class/0.08/trunk/t/76select.t
Log:
Moev failing regression test away from trunk

Modified: DBIx-Class/0.08/branches/chaining_fixes/t/88result_set_column.t
===================================================================
--- DBIx-Class/0.08/branches/chaining_fixes/t/88result_set_column.t	2010-01-22 10:25:01 UTC (rev 8412)
+++ DBIx-Class/0.08/branches/chaining_fixes/t/88result_set_column.t	2010-01-22 10:35:15 UTC (rev 8413)
@@ -75,7 +75,7 @@
 # test +select/+as for multiple columns
 $psrs = $schema->resultset('CD')->search({},
     {
-        '+select'   => [ \'COUNT(*)', 'title' ],
+        '+select'   => [ \'COUNT(*) AS cnt', 'title' ],
         '+as'       => [ 'count', 'addedtitle' ]
     }
 );
@@ -104,7 +104,16 @@
   'Correct SQL for get_column/+as func'
 );
 
+# test correct subquery with +select when necessary
+lives_ok ( sub {
+  is (
+    scalar $psrs->search ({}, { order_by => 'cnt' })->get_column ('year')->all,
+    $psrs->count,
+    'Subquery count induced by aliased function',
+  );
+});
 
+# test for prefetch not leaking
 {
   my $rs = $schema->resultset("CD")->search({}, { prefetch => 'artist' });
   my $rsc = $rs->get_column('year');

Modified: DBIx-Class/0.08/trunk/t/76select.t
===================================================================
--- DBIx-Class/0.08/trunk/t/76select.t	2010-01-22 10:25:01 UTC (rev 8412)
+++ DBIx-Class/0.08/trunk/t/76select.t	2010-01-22 10:35:15 UTC (rev 8413)
@@ -1,5 +1,5 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
 use Test::Exception;
@@ -9,8 +9,6 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 24;
-
 my $rs = $schema->resultset('CD')->search({},
     {
         '+select'   => \ 'COUNT(*)',
@@ -29,16 +27,6 @@
 lives_ok(sub { $rs->first->get_column('count') }, 'multiple +select/+as columns, 1st rscolumn present');
 lives_ok(sub { $rs->first->get_column('addedtitle') }, 'multiple +select/+as columns, 2nd rscolumn present');
 
-# Tests a regression in ResultSetColumn wrt +select
-$rs = $schema->resultset('CD')->search(undef,
-    {
-        '+select'   => [ \'COUNT(*) AS year_count' ],
-        order_by => 'year_count'
-    }
-);
-my @counts = $rs->get_column('cdid')->all;
-ok(scalar(@counts), 'got rows from ->all using +select');
-
 $rs = $schema->resultset('CD')->search({},
     {
         '+select'   => [ \ 'COUNT(*)', 'title' ],
@@ -196,3 +184,5 @@
     'columns/select/as fold properly on sub-searches',
   );
 }
+
+done_testing;




More information about the Bast-commits mailing list