[Bast-commits] r8450 - in DBIx-Class/0.08/trunk/t: . inflate prefetch sqlahacks/quotes storage

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed Jan 27 11:08:05 GMT 2010


Author: ribasushi
Date: 2010-01-27 11:08:04 +0000 (Wed, 27 Jan 2010)
New Revision: 8450

Modified:
   DBIx-Class/0.08/trunk/t/26dumper.t
   DBIx-Class/0.08/trunk/t/76joins.t
   DBIx-Class/0.08/trunk/t/76select.t
   DBIx-Class/0.08/trunk/t/inflate/file_column.t
   DBIx-Class/0.08/trunk/t/inflate/hri.t
   DBIx-Class/0.08/trunk/t/prefetch/diamond.t
   DBIx-Class/0.08/trunk/t/prefetch/standard.t
   DBIx-Class/0.08/trunk/t/prefetch/with_limit.t
   DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes.t
   DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes_newstyle.t
   DBIx-Class/0.08/trunk/t/storage/debug.t
Log:
Merge some cleanups from the prefetch branch

Modified: DBIx-Class/0.08/trunk/t/26dumper.t
===================================================================
--- DBIx-Class/0.08/trunk/t/26dumper.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/26dumper.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -1,6 +1,5 @@
 use strict;
 use Test::More;
-use IO::File;
 
 use Data::Dumper;
 $Data::Dumper::Sortkeys = 1;

Modified: DBIx-Class/0.08/trunk/t/76joins.t
===================================================================
--- DBIx-Class/0.08/trunk/t/76joins.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/76joins.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -10,8 +10,6 @@
 
 my $orig_debug = $schema->storage->debug;
 
-use IO::File;
-
 BEGIN {
     eval "use DBD::SQLite";
     plan $@

Modified: DBIx-Class/0.08/trunk/t/76select.t
===================================================================
--- DBIx-Class/0.08/trunk/t/76select.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/76select.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -89,13 +89,13 @@
 }, 'columns 2nd rscolumn present');
 
 lives_ok(sub {
-  $rs->first->artist->get_column('name') 
-}, 'columns 3rd rscolumn present'); 
+  $rs->first->artist->get_column('name')
+}, 'columns 3rd rscolumn present');
 
 
 
 $rs = $schema->resultset('CD')->search({},
-    {  
+    {
         'join' => 'artist',
         '+columns' => ['cdid', 'title', 'artist.name'],
     }
@@ -109,7 +109,7 @@
 );
 
 lives_ok(sub {
-  $rs->first->get_column('cdid') 
+  $rs->first->get_column('cdid')
 }, 'columns 1st rscolumn present');
 
 lives_ok(sub {
@@ -153,36 +153,17 @@
   }
 );
 
-is_deeply (
+is_deeply(
   $sub_rs->single,
   {
-    artist => 1,
+    artist         => 1,
     track_position => 2,
-    tracks =>
-      {
-        trackid => 17,
-        title => 'Apiary',
-      },
+    tracks         => {
+      trackid => 17,
+      title   => 'Apiary',
+    },
   },
   'columns/select/as fold properly on sub-searches',
 );
 
-TODO: {
-  local $TODO = "Multi-collapsing still doesn't work right - HRI should be getting an arrayref, not an individual hash";
-  is_deeply (
-    $sub_rs->single,
-    {
-      artist => 1,
-      track_position => 2,
-      tracks => [
-        {
-          trackid => 17,
-          title => 'Apiary',
-        },
-      ],
-    },
-    'columns/select/as fold properly on sub-searches',
-  );
-}
-
 done_testing;

Modified: DBIx-Class/0.08/trunk/t/inflate/file_column.t
===================================================================
--- DBIx-Class/0.08/trunk/t/inflate/file_column.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/inflate/file_column.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -4,7 +4,6 @@
 use Test::More;
 use lib qw(t/lib);
 use DBICTest;
-use IO::File;
 use File::Compare;
 use Path::Class qw/file/;
 

Modified: DBIx-Class/0.08/trunk/t/inflate/hri.t
===================================================================
--- DBIx-Class/0.08/trunk/t/inflate/hri.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/inflate/hri.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -30,7 +30,7 @@
 
 sub check_cols_of {
     my ($dbic_obj, $datahashref) = @_;
-    
+
     foreach my $col (keys %$datahashref) {
         # plain column
         if (not ref ($datahashref->{$col}) ) {
@@ -44,14 +44,14 @@
         elsif (ref ($datahashref->{$col}) eq 'ARRAY') {
             my @dbic_reltable = $dbic_obj->$col;
             my @hashref_reltable = @{$datahashref->{$col}};
-  
+
             is (scalar @dbic_reltable, scalar @hashref_reltable, 'number of related entries');
 
             # for my $index (0..scalar @hashref_reltable) {
             for my $index (0..scalar @dbic_reltable) {
                 my $dbic_reltable_obj       = $dbic_reltable[$index];
                 my $hashref_reltable_entry  = $hashref_reltable[$index];
-                
+
                 check_cols_of($dbic_reltable_obj, $hashref_reltable_entry);
             }
         }
@@ -139,3 +139,4 @@
 );
 
 done_testing;
+

Modified: DBIx-Class/0.08/trunk/t/prefetch/diamond.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/diamond.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/prefetch/diamond.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -96,12 +96,12 @@
   }
 }
 
-plan tests => (scalar (keys %tests) * 3);
-
 foreach my $name (keys %tests) {
   foreach my $artwork ($tests{$name}->all()) {
     is($artwork->id, 1, $name . ', correct artwork');
     is($artwork->cd->artist->artistid, 1, $name . ', correct artist_id over cd');
     is($artwork->artwork_to_artist->first->artist->artistid, 2, $name . ', correct artist_id over A2A');
   }
-}
\ No newline at end of file
+}
+
+done_testing;

Modified: DBIx-Class/0.08/trunk/t/prefetch/standard.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/standard.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/prefetch/standard.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -5,7 +5,6 @@
 use Test::Exception;
 use lib qw(t/lib);
 use DBICTest;
-use IO::File;
 
 my $schema = DBICTest->init_schema();
 my $orig_debug = $schema->storage->debug;

Modified: DBIx-Class/0.08/trunk/t/prefetch/with_limit.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/with_limit.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/prefetch/with_limit.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -8,8 +8,6 @@
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 9;
-
 my $schema = DBICTest->init_schema();
 
 
@@ -25,6 +23,8 @@
 my $use_prefetch = $no_prefetch->search(
   {},
   {
+    select => ['me.artistid', 'me.name'],
+    as => ['artistid', 'name'],
     prefetch => 'cds',
     order_by => { -desc => 'name' },
   }
@@ -90,3 +90,4 @@
 my $artist2 = $use_prefetch->search({'cds.title' => { '!=' => $artist_many_cds->cds->first->title } })->slice (0,0)->next;
 is($artist2->cds->count, 2, "count on search limiting prefetched has_many");
 
+done_testing;

Modified: DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes.t
===================================================================
--- DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -2,7 +2,6 @@
 use warnings;
 
 use Test::More;
-use IO::File;
 
 use lib qw(t/lib);
 use DBIC::SqlMakerTest;

Modified: DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes_newstyle.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/sqlahacks/quotes/quotes_newstyle.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -2,7 +2,6 @@
 use warnings;
 
 use Test::More;
-use IO::File;
 
 use lib qw(t/lib);
 use DBIC::SqlMakerTest;

Modified: DBIx-Class/0.08/trunk/t/storage/debug.t
===================================================================
--- DBIx-Class/0.08/trunk/t/storage/debug.t	2010-01-27 11:00:02 UTC (rev 8449)
+++ DBIx-Class/0.08/trunk/t/storage/debug.t	2010-01-27 11:08:04 UTC (rev 8450)
@@ -6,25 +6,19 @@
 use DBICTest;
 use DBIC::DebugObj;
 use DBIC::SqlMakerTest;
+use Path::Class qw/file/;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 7;
 
 ok ( $schema->storage->debug(1), 'debug' );
-ok ( defined(
-       $schema->storage->debugfh(
-         IO::File->new('t/var/sql.log', 'w')
-       )
-     ),
-     'debugfh'
-   );
+$schema->storage->debugfh(file('t/var/sql.log')->openw);
 
 $schema->storage->debugfh->autoflush(1);
 my $rs = $schema->resultset('CD')->search({});
 $rs->count();
 
-my $log = new IO::File('t/var/sql.log', 'r') or die($!);
+my $log = file('t/var/sql.log')->openr;
 my $line = <$log>;
 $log->close();
 ok($line =~ /^SELECT COUNT/, 'Log success');
@@ -33,7 +27,7 @@
 $ENV{'DBIC_TRACE'} = '=t/var/foo.log';
 $rs = $schema->resultset('CD')->search({});
 $rs->count();
-$log = new IO::File('t/var/foo.log', 'r') or die($!);
+$log = file('t/var/foo.log')->openr;
 $line = <$log>;
 $log->close();
 ok($line =~ /^SELECT COUNT/, 'Log success');
@@ -70,4 +64,4 @@
     );
 }
 
-1;
+done_testing;




More information about the Bast-commits mailing list