Restore perl version requirement missed in the Distar port
[dbsrgits/SQL-Abstract.git] / t / 05in_between.t
index 1111998..00fbd21 100644 (file)
@@ -174,6 +174,17 @@ my @in_between_tests = (
     bind => [],
     test => '-in multi-line subquery test',
   },
+
+  # check that the outer paren opener is not too agressive
+  # note: this syntax *is not legal* on SQLite (maybe others)
+  #       see end of https://rt.cpan.org/Ticket/Display.html?id=99503
+  {
+    where => { foo => { -in => \ '(SELECT 1) UNION (SELECT 2)' } },
+    stmt => 'WHERE foo IN ( (SELECT 1) UNION (SELECT 2) )',
+    bind => [],
+    test => '-in paren-opening works on balanced pairs only',
+  },
+
   {
     where => {
       customer => { -in => \[
@@ -266,6 +277,17 @@ my @in_between_tests = (
     throws => qr/Argument passed to the 'IN' operator can not be undefined/,
     test => '-in with undef argument',
   },
+
+  {
+    where => { -in => [42] },
+    throws => qr/Illegal use of top-level '-in'/,
+    test => 'Top level -in',
+  },
+  {
+    where => { -between => [42, 69] },
+    throws => qr/Illegal use of top-level '-between'/,
+    test => 'Top level -between',
+  },
 );
 
 for my $case (@in_between_tests) {