From: Peter Rabbitson Date: Mon, 9 Mar 2009 01:32:08 +0000 (+0000) Subject: Enhance values test X-Git-Tag: v1.70~216 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c59982bbe83211270560d00e073567c29708c7a5;p=dbsrgits%2FSQL-Abstract.git Enhance values test --- diff --git a/t/02where.t b/t/02where.t index b169de1..8586991 100644 --- a/t/02where.t +++ b/t/02where.t @@ -13,8 +13,7 @@ use SQL::Abstract; my $not_stringifiable = bless {}, 'SQLA::NotStringifiable'; -my@x=( -);my @handle_tests = ( +my @handle_tests = ( { where => { requestor => 'inna', @@ -199,19 +198,17 @@ my@x=( { where => \[ 'foo = ?','bar' ], - stmt => " WHERE (foo = ?)", + stmt => " WHERE (foo = ?)", bind => [ "bar" ], }, { where => [ \[ 'foo = ?','bar' ] ], - stmt => " WHERE (foo = ?)", + stmt => " WHERE (foo = ?)", bind => [ "bar" ], }, -);my@x2=( ); - plan tests => ( @handle_tests * 2 ) + 1; for my $case (@handle_tests) { diff --git a/t/03values.t b/t/03values.t index db28ab0..c0ec9cc 100644 --- a/t/03values.t +++ b/t/03values.t @@ -94,20 +94,28 @@ 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], 'values() output matches that of initial bind' - );# || diag "Corresponding SQL statement: $stmt"; + ) || diag "Corresponding SQL statement: $stmt"; }