call op expanders for unop hashpairs, move ident and value to op-only expand
[scpubgit/Q-Branch.git] / t / 00new.t
index 5da3446..7cb7103 100644 (file)
--- a/t/00new.t
+++ b/t/00new.t
@@ -1,8 +1,10 @@
 use strict;
 use warnings;
 use Test::More;
+use Test::Warn;
+use Test::Exception;
 
-use SQL::Abstract::Test import => ['is_same_sql'];
+use SQL::Abstract::Test import => [ qw(is_same_sql dumper) ];
 use SQL::Abstract;
 
 my @handle_tests = (
@@ -82,16 +84,22 @@ my @handle_tests = (
                         { a => [qw/b c d/],
                           e => { '!=', [qw(f g)] },
                           q => { 'not in', [14..20] } } ],
+              warns => qr/\QA multi-element arrayref as an argument to the inequality op '!=' is technically equivalent to an always-true 1=1/,
       },
 );
 
 for (@handle_tests) {
   my $sqla  = SQL::Abstract->new($_->{args});
-  my($stmt) = $sqla->select(
-    'test',
-    '*',
-    $_->{where} || { a => 4, b => 0}
-  );
+  my $stmt;
+  lives_ok(sub {
+    (warnings_exist {
+      $stmt = $sqla->select(
+        'test',
+        '*',
+        $_->{where} || { a => 4, b => 0}
+      );
+    } $_->{warns} || []) || diag dumper($_);
+  }) or diag dumper({ %$_, threw => $@ });
 
   is_same_sql($stmt, $_->{stmt});
 }