X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F95sql_maker.t;h=0f7dda87196f5450f2c7211fd6b9aea4c9b483dd;hb=18c72236adec093c680be1c00df7297c42b907eb;hp=0971d1202c448428d33e71a283361ad887748a43;hpb=e5938571f31c21e93865da521f2fa1c14e45827e;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/95sql_maker.t b/t/95sql_maker.t index 0971d12..0f7dda8 100644 --- a/t/95sql_maker.t +++ b/t/95sql_maker.t @@ -2,8 +2,9 @@ use strict; use warnings; use Test::More; -use SQL::Abstract::Test import => ['is_same_sql_bind']; +use lib qw(t/lib); +use DBIC::SqlMakerTest; BEGIN { eval "use DBD::SQLite"; @@ -12,8 +13,6 @@ BEGIN { : ( tests => 3 ); } -use lib qw(t/lib); - use_ok('DBICTest'); my $schema = DBICTest->init_schema(); @@ -21,33 +20,38 @@ my $schema = DBICTest->init_schema(); my $sql_maker = $schema->storage->sql_maker; -my ($sql, @bind) = $sql_maker->insert( - 'lottery', - { - 'day' => '2008-11-16', - 'numbers' => [13, 21, 34, 55, 89] - } -); - -is_same_sql_bind( - $sql, \@bind, - q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/, - [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ], - 'sql_maker passes arrayrefs in insert' -); - - -($sql, @bind) = $sql_maker->update( - 'lottery', - { - 'day' => '2008-11-16', - 'numbers' => [13, 21, 34, 55, 89] - } -); - -is_same_sql_bind( - $sql, \@bind, - q/UPDATE lottery SET day = ?, numbers = ?/, - [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ], - 'sql_maker passes arrayrefs in update' -); +SKIP: { + skip "SQL::Abstract < 1.49 does not pass through arrayrefs", 2 + if $SQL::Abstract::VERSION < 1.49; + + my ($sql, @bind) = $sql_maker->insert( + 'lottery', + { + 'day' => '2008-11-16', + 'numbers' => [13, 21, 34, 55, 89] + } + ); + + is_same_sql_bind( + $sql, \@bind, + q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/, + [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ], + 'sql_maker passes arrayrefs in insert' + ); + + + ($sql, @bind) = $sql_maker->update( + 'lottery', + { + 'day' => '2008-11-16', + 'numbers' => [13, 21, 34, 55, 89] + } + ); + + is_same_sql_bind( + $sql, \@bind, + q/UPDATE lottery SET day = ?, numbers = ?/, + [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ], + 'sql_maker passes arrayrefs in update' + ); +}