Merge 'trunk' into 'count_distinct'
[dbsrgits/DBIx-Class.git] / t / resultset / as_query.t
index c496085..f849f7a 100644 (file)
@@ -7,7 +7,7 @@ use Data::Dumper;
 
 use Test::More;
 
-plan ( tests => 4 );
+plan ( tests => 5 );
 
 use lib qw(t/lib);
 use DBICTest;
@@ -65,3 +65,13 @@ my $rscol = $art_rs->get_column( 'charfield' );
     [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
   );
 }
+
+TODO: {
+    local $TODO = 'Needs -paren fixes in SQLA before it can work';
+    my $rs = $schema->resultset("CD")->search(
+        { 'artist.name' => 'Caterwauler McCrae' },
+        { join => [qw/artist/]}
+    );
+    my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $rs->get_column('cdid')->as_query } } );
+    cmp_ok($subsel_rs->count, '==', $rs->count, 'Subselect on PK got the same row count');
+}