Convert (in)equality with undef to (not) defined/IS NOT NULL ops
[dbsrgits/Data-Query.git] / t / sql.t
diff --git a/t/sql.t b/t/sql.t
index 6bf46e8..b5c9294 100644 (file)
--- a/t/sql.t
+++ b/t/sql.t
@@ -49,6 +49,14 @@ expr_sql_is { !$_->foo } # XXX revisit this why are the parens here
   [ "( NOT foo )" ],
   "Unary expression ok";
 
+expr_sql_is { $_->foo != undef }
+  [ "foo IS NOT NULL" ],
+  "!= undef => IS NOT NULL";
+
+expr_sql_is { $_->foo == undef }
+  [ "( NOT foo IS NOT NULL )" ],
+  "== undef => ( NOT foo IS NOT NULL )";
+
 expr_sql_is { SELECT { $_->foo } }
   [ "SELECT foo" ],
   "Simple identifier";
@@ -66,3 +74,4 @@ expr_sql_is { SELECT { $_->foo => AS("foom"), 1 } }
 expr_sql_is { SELECT { $_->foo => AS "foom", 1 } }
   [ "SELECT foo AS foom, ?", binding(1) ],
   "AS without parens";
+