Merge branch 'master' into dq
[dbsrgits/SQL-Abstract.git] / t / 05in_between.t
index abc35d6..7336158 100644 (file)
@@ -134,7 +134,7 @@ my @in_between_tests = (
   {
     parenthesis_significant => 1,
     where => { x => { -in => \['( ( ?,?,lower(y) ) )', 1, 2] } },
-    stmt => "WHERE ( x IN ( ( ?,?,lower(y) ) ) )",  # note that outer parens are opened even though literal was requested (RIBASUSHI)
+    stmt => "WHERE ( x IN ( ?,?,lower(y) ) )",  # note that outer parens are opened even though literal was requested (RIBASUSHI)
     bind => [1, 2],
     test => '-in with a literal arrayrefref',
   },
@@ -152,10 +152,10 @@ my @in_between_tests = (
     parenthesis_significant => 1,
     where => {
       customer => { -in => \[
-        '( SELECT cust_id FROM cust WHERE balance > ? )',
+        'SELECT cust_id FROM cust WHERE balance > ?',
         2000,
       ]},
-      status => { -in => \'( SELECT status_codes FROM states )' },
+      status => { -in => \'SELECT status_codes FROM states' },
     },
     stmt => "
       WHERE ((
@@ -174,20 +174,18 @@ my @in_between_tests = (
   },
   {
     where => { x => { -in => [ 1, undef ] } },
-    stmt => " WHERE ( x IN ( ?, NULL ) )",
-    bind => [ 1 ],
+    stmt => " WHERE ( x IN ( ?, ? ) )",
+    bind => [ 1, undef ],
     test => '-in with undef as an element', 
   },
   {
     where => { x => { -in => [ 1, undef, 2, 3, undef ] } },
-    stmt => " WHERE ( x IN ( ?, NULL, ?, ?, NULL ) )",
-    bind => [ 1, 2, 3 ],
+    stmt => " WHERE ( x IN ( ?, ?, ?, ?, ? ) )",
+    bind => [ 1, undef, 2, 3, undef ],
     test => '-in with undef as an element',
   },
 );
 
-plan tests => @in_between_tests*3;
-
 for my $case (@in_between_tests) {
   TODO: {
     local $TODO = $case->{todo} if $case->{todo};
@@ -214,3 +212,5 @@ for my $case (@in_between_tests) {
     diag "Error: $e\n Search term:\n".Dumper($case->{where}) if $e;
   }
 }
+
+done_testing;