X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05in_between.t;fp=t%2F05between.t;h=ae6e61cad6d9b15425cab7aa9e3a119517665e51;hb=4a1f01a3175d4c88af2adebe6b0482e57ee4c88a;hp=a155b20d35bb6f61cc6ba7e1edb727ec43dd8153;hpb=14190bdf09cf5ac3da6892b0b5b78bcd8eff4eeb;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/05between.t b/t/05in_between.t similarity index 80% rename from t/05between.t rename to t/05in_between.t index a155b20..ae6e61c 100644 --- a/t/05between.t +++ b/t/05in_between.t @@ -9,20 +9,6 @@ use SQL::Abstract::Test import => ['is_same_sql_bind']; use Data::Dumper; use SQL::Abstract; -=begin -Test -between and -in - * between - * [scalar, scalar] - * [scalarref, scalar] - * [scalar, scalarref] - * [scalarref, scalarref] - * \[] - * \["? AND ?", scalar, scalar] - * \["1 AND ?", scalar] - * \["? AND 2", scalar] - * \["1 AND 2"] -=cut - my @in_between_tests = ( { where => { x => { -between => [1, 2] } }, @@ -78,6 +64,29 @@ my @in_between_tests = ( bind => [], test => '-between with literal sql with a literal (\"\'this\' AND \'that\'")', }, + + + { + parenthesis_significant => 1, + where => { x => { -in => [ 1 .. 3] } }, + stmt => "WHERE ( x IN (?, ?, ?) )", + bind => [ 1 .. 3], + test => '-in with an array of scalars', + }, + { + parenthesis_significant => 1, + where => { x => { -in => \'( 1,2,lower(y) )' } }, + stmt => "WHERE ( x IN (1, 2, lower(y) ) )", + bind => [], + test => '-in with a literal scalarref', + }, + { + parenthesis_significant => 1, + where => { x => { -in => \['( ( ?,?,lower(y) ) )', 1, 2] } }, + stmt => "WHERE ( x IN (?, ?, lower(y) ) )", + bind => [1, 2], + test => '-in with a literal arrayrefref', + }, ); plan tests => @in_between_tests*4; @@ -85,6 +94,7 @@ plan tests => @in_between_tests*4; for my $case (@in_between_tests) { TODO: { local $TODO = $case->{todo} if $case->{todo}; + local $SQL::Abstract::Test::parenthesis_significant = $case->{parenthesis_significant}; local $Data::Dumper::Terse = 1;