6d430ca3f56c856cae07e964ff3e538083dcc8d9
[dbsrgits/DBIx-Class.git] / t / sqlmaker / nest_deprec.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Warn;
8
9
10 use DBICTest ':DiffSQL';
11
12 my $schema = DBICTest->init_schema();
13
14 my $sql_maker = $schema->storage->sql_maker;
15
16 # a loop so that the callsite line does not change
17 for my $expect_warn (1, 0) {
18   warnings_like (
19     sub {
20       my ($sql, @bind) = $sql_maker->select ('foo', '*', { -nest => \ 'bar' } );
21       is_same_sql_bind (
22         $sql, \@bind,
23         'SELECT * FROM foo WHERE ( bar )', [],
24         '-nest still works'
25       );
26     },
27     ($expect_warn ? qr/\Q-nest in search conditions is deprecated/ : []),
28     'Only one deprecation warning'
29   );
30 }
31
32 done_testing;