Failing test
[scpubgit/Q-Branch.git] / t / 02where.t
index 774fc80..0790a64 100644 (file)
@@ -117,6 +117,14 @@ my @handle_tests = (
 
     {
         where => {  
+            requestor => { '!=', ['-and', undef, ''] },
+        },
+        stmt => " WHERE ( requestor IS NOT NULL AND requestor != ? )",
+        bind => [''],
+    },
+
+    {
+        where => {  
             priority  => [ {'>', 3}, {'<', 1} ],
             requestor => { '!=', undef }, 
         },
@@ -301,6 +309,30 @@ my @handle_tests = (
        bind => [1, 2],
    },
 
+# Op against internal function
+   {
+       where => { bool1 => { '=' => { -not_bool => 'bool2' } } },
+       stmt => " WHERE ( bool1 = NOT(bool2) )",
+       bind => [],
+   },
+   {
+       where => { -not_bool => { -not_bool => { -not_bool => 'bool2' } } },
+       stmt => " WHERE ( NOT ( NOT ( NOT bool2 ) ) )",
+       bind => [],
+   },
+
+# Op against random functions (these two are oracle-specific)
+   {
+       where => { timestamp => { '!=' => { -trunk => \'sysdate' } } },
+       stmt => " WHERE ( timestamp != TRUNC(sysdate) )",
+       bind => [],
+   },
+   {
+       where => { timestamp => { '>=' => { -TO_DATE => '2009-12-21 00:00:00' } } },
+       stmt => " WHERE ( timestamp >= TO_DATE(?) )",
+       bind => ['2009-12-21 00:00:00'],
+   },
+
 );
 
 plan tests => ( @handle_tests * 2 ) + 1;
@@ -311,7 +343,7 @@ for my $case (@handle_tests) {
     my($stmt, @bind);
     lives_ok (sub { 
       ($stmt, @bind) = $sql->where($case->{where}, $case->{order});
-      is_same_sql_bind($stmt, \@bind, $case->{stmt}, $case->{bind}, $stmt)
+      is_same_sql_bind($stmt, \@bind, $case->{stmt}, $case->{bind})
         || diag "Search term:\n" . Dumper $case->{where};
     });
 }