From: Rafael Kitover Date: Wed, 20 May 2009 03:58:36 +0000 (+0000) Subject: add test for distinct result of sql function X-Git-Tag: v0.08103~58 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=909a20df412c7599b3b473d8c776507121cb67ba;p=dbsrgits%2FDBIx-Class.git add test for distinct result of sql function --- diff --git a/t/count/distinct.t b/t/count/distinct.t index 62afa8d..f3435dc 100644 --- a/t/count/distinct.t +++ b/t/count/distinct.t @@ -13,7 +13,7 @@ my $schema = DBICTest->init_schema(); eval "use DBD::SQLite"; plan skip_all => 'needs DBD::SQLite for testing' if $@; -plan tests => 18; +plan tests => 19; # The tag Blue is assigned to cds 1 2 3 and 5 # The tag Cheesy is assigned to cds 2 4 and 5 @@ -71,6 +71,12 @@ is($rs->count, 5, 'Count with literal SQL and another single group_by'); $rs = $schema->resultset('Tag')->search({ tag => \" IN ('Blue', 'Cheesy')" }, { group_by => [ qw/tag cd/ ] }); is($rs->count, 7, 'Count with literal SQL and multiple group_by'); +$rs = $schema->resultset('Tag')->search({}, { + select => { length => 'tag' }, + distinct => 1 +}); +is($rs->count, 3, 'Count by distinc result of function'); + my @warnings; { local $SIG{__WARN__} = sub { push @warnings, shift };