Merge HasA, HasMany and MightHave into one file, Relationships, for easier
[dbsrgits/DBIx-Class-Historic.git] / t / 76joins.t
index 89c619d..92e5785 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
     eval "use DBD::SQLite";
     plan $@
         ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 63 );
+        : ( tests => 64 );
 }
 
 # figure out if we've got a version of sqlite that is older than 3.2.6, in
@@ -146,6 +146,9 @@ $rs = $schema->resultset("CD")->search(
 );
 cmp_ok( scalar $rs->all, '==', scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' );
 
+ok(!$rs->slice($rs->count+1000, $rs->count+1002)->count,
+  'Slicing beyond end of rs returns a zero count');
+
 $rs = $schema->resultset("Artist")->search(
         { 'liner_notes.notes' => 'Kill Yourself!' },
         { join => { 'cds' => 'liner_notes' } });
@@ -336,7 +339,7 @@ SKIP: {
 
 is($rs->next->name, 'Caterwauler McCrae', "Correct artist returned");
 
-my $cd = $schema->resultset('Artist')->first->create_related('cds',
+$cd = $schema->resultset('Artist')->first->create_related('cds',
     {
     title   => 'Unproduced Single',
     year    => 2007