From: Rob Kinyon Date: Tue, 10 Feb 2009 22:53:48 +0000 (+0000) Subject: Switched to use is_same_sql_bind() per ribasushi's suggestion X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=152d414da2432cc95b79302a70a59b4cca4f5338;p=dbsrgits%2FDBIx-Class-Historic.git Switched to use is_same_sql_bind() per ribasushi's suggestion --- diff --git a/t/resultset/as_query.t b/t/resultset/as_query.t index 23f301f..b4fa422 100644 --- a/t/resultset/as_query.t +++ b/t/resultset/as_query.t @@ -6,8 +6,9 @@ use warnings FATAL => 'all'; use Test::More; use lib qw(t/lib); use DBICTest; +use DBIC::SqlMakerTest; -plan tests => 8; +plan tests => 4; my $schema = DBICTest->init_schema(); my $art_rs = $schema->resultset('Artist'); @@ -16,8 +17,10 @@ my $art_rs = $schema->resultset('Artist'); my $arr = $art_rs->as_query; my ($query, @bind) = @$arr; - is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me" ); - is_deeply( \@bind, [] ); + is_same_sql_bind( + $query, \@bind, + "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me", [], + ); } $art_rs = $art_rs->search({ name => 'Billy Joel' }); @@ -26,8 +29,11 @@ $art_rs = $art_rs->search({ name => 'Billy Joel' }); my $arr = $art_rs->as_query; my ($query, @bind) = @$arr; - is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? )" ); - is_deeply( \@bind, [ [ name => 'Billy Joel' ] ] ); + is_same_sql_bind( + $query, \@bind, + "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? )", + [ [ name => 'Billy Joel' ] ], + ); } $art_rs = $art_rs->search({ rank => 2 }); @@ -36,8 +42,11 @@ $art_rs = $art_rs->search({ rank => 2 }); my $arr = $art_rs->as_query; my ($query, @bind) = @$arr; - is( $query, "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )" ); - is_deeply( \@bind, [ [ rank => 2 ], [ name => 'Billy Joel' ] ] ); + is_same_sql_bind( + $query, \@bind, + "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )", + [ [ rank => 2 ], [ name => 'Billy Joel' ] ], + ); } my $rscol = $art_rs->get_column( 'charfield' ); @@ -46,8 +55,11 @@ my $rscol = $art_rs->get_column( 'charfield' ); my $arr = $rscol->as_query; my ($query, @bind) = @$arr; - is( $query, "SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )" ); - is_deeply( \@bind, [ [ rank => 2 ], [ name => 'Billy Joel' ] ] ); + is_same_sql_bind( + $query, \@bind, + "SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )", + [ [ rank => 2 ], [ name => 'Billy Joel' ] ], + ); } __END__