Tighten up select list processing in ::SQLMaker
[dbsrgits/DBIx-Class.git] / t / sqlmaker / core_quoted.t
index 8e45566..8682093 100644 (file)
@@ -1,9 +1,11 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+
 use strict;
 use warnings;
 
 use Test::More;
+use Test::Warn;
 
-use lib qw(t/lib);
 use DBICTest ':DiffSQL';
 
 my $schema = DBICTest->init_schema();
@@ -352,4 +354,15 @@ is_same_sql_bind(
   'bracket quoted table names for UPDATE'
 );
 
+
+# Warning and sane behavior on ... select => [] ...
+warnings_exist {
+  local $TODO = "Some day we need to stop issuing implicit SELECT *";
+  is_same_sql_bind(
+    $schema->resultset("Artist")->search({}, { columns => [] })->as_query,
+    '( SELECT 42 FROM [artist] [me] )',
+    [],
+  );
+} qr/\QResultSets with an empty selection are deprecated (you almost certainly did not mean to do that): if this is indeed your intent you must explicitly supply/;
+
 done_testing;