X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F03values.t;h=9915712014698b69a5f667689d5b3674d2b7bec3;hb=df7b1db3fac6b264486bde43d4ef250035126885;hp=27f3013dc0edf4b69d69e28a3bee22159d5365cd;hpb=397986c42758b382e96b4dde9736ab578a761d10;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/03values.t b/t/03values.t index 27f3013..9915712 100644 --- a/t/03values.t +++ b/t/03values.t @@ -1,5 +1,3 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; @@ -55,9 +53,6 @@ my @data = ( }, ); - -plan tests => (@data * 5 + 2); - # test insert() and values() for reentrancy my($insert_hash, $insert_array, $numfields); my $a_sql = SQL::Abstract->new; @@ -94,20 +89,30 @@ for my $record (@data) { { my $sql = SQL::Abstract->new; - my $data = { event => 'rapture', time => \ 'now()', xfunc => \ 'somefunc(?)', stuff => 'fluff', }; + my $data = { + event => 'rapture', + stuff => 'fluff', + time => \ 'now()', + xfunc => \ 'xfunc(?)', + yfunc => ['yfunc(?)', 'ystuff' ], + zfunc => \['zfunc(?)', 'zstuff' ], + zzlast => 'zzstuff', + }; my ($stmt, @bind) = $sql->insert ('table', $data); is_same_sql_bind ( $stmt, \@bind, - 'INSERT INTO table ( event, stuff, time, xfunc) VALUES ( ?, ?, now(), somefunc (?) )', - [qw/rapture fluff/], # event < stuff + 'INSERT INTO table ( event, stuff, time, xfunc, yfunc, zfunc, zzlast) VALUES ( ?, ?, now(), xfunc (?), yfunc(?), zfunc(?), ? )', + [qw/rapture fluff ystuff zstuff zzstuff/], # event < stuff ); is_same_bind ( [$sql->values ($data)], - [\@bind], + [@bind], 'values() output matches that of initial bind' ) || diag "Corresponding SQL statement: $stmt"; } + +done_testing;