[Bast-commits] r4613 - DBIx-Class/0.08/trunk/t

castaway at dev.catalyst.perl.org castaway at dev.catalyst.perl.org
Thu Jul 24 07:42:35 BST 2008


Author: castaway
Date: 2008-07-24 07:42:34 +0100 (Thu, 24 Jul 2008)
New Revision: 4613

Added:
   DBIx-Class/0.08/trunk/t/98rows_prefetch.t
Log:
Added 98rows_prefetch.t from Christopher Davaz, todo test for prefetch with rows


Added: DBIx-Class/0.08/trunk/t/98rows_prefetch.t
===================================================================
--- DBIx-Class/0.08/trunk/t/98rows_prefetch.t	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/98rows_prefetch.t	2008-07-24 06:42:34 UTC (rev 4613)
@@ -0,0 +1,42 @@
+# Test to ensure we get a consistent result set wether or not we use the
+# prefetch option in combination rows (LIMIT).
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 2);
+
+my $schema = DBICTest->init_schema();
+my $no_prefetch = $schema->resultset('Artist')->search(
+	undef,
+	{ rows => 3 }
+);
+
+my $use_prefetch = $schema->resultset('Artist')->search(
+	undef,
+	{
+		prefetch => 'cds',
+		rows     => 3
+	}
+);
+
+my $no_prefetch_count  = 0;
+my $use_prefetch_count = 0;
+
+is($no_prefetch->count, $use_prefetch->count, '$no_prefetch->count == $use_prefetch->count');
+
+TODO: {
+	local $TODO = "This is a difficult bug to fix, workaround is not to use prefetch with rows";
+	$no_prefetch_count++  while $no_prefetch->next;
+	$use_prefetch_count++ while $use_prefetch->next;
+	is(
+		$no_prefetch_count,
+		$use_prefetch_count,
+		"manual row count confirms consistency"
+		. " (\$no_prefetch_count == $no_prefetch_count, "
+		. " \$use_prefetch_count == $use_prefetch_count)"
+	);
+}




More information about the Bast-commits mailing list