Normalize handling of expected warnings/exceptions in tests
[dbsrgits/SQL-Abstract.git] / t / 21op_ident.t
CommitLineData
cc422895 1use strict;
2use warnings;
3
4use Test::More;
5use SQL::Abstract;
6use SQL::Abstract::Test import => [qw/is_same_sql_bind/];
7
8
9for my $q ('', '"') {
10 my $sql_maker = SQL::Abstract->new(
11 quote_char => $q,
12 name_sep => $q ? '.' : '',
13 );
14
15 my ($sql, @bind) = $sql_maker->select ('artist', '*', { 'artist.name' => { -ident => 'artist.pseudonym' } } );
16 is_same_sql_bind (
17 $sql,
18 \@bind,
19 "SELECT *
20 FROM ${q}artist${q}
21 WHERE ${q}artist${q}.${q}name${q} = ${q}artist${q}.${q}pseudonym${q}
22 ",
23 [],
24 );
25
26 ($sql, @bind) = $sql_maker->update ('artist',
27 { 'artist.name' => { -ident => 'artist.pseudonym' } },
28 { 'artist.name' => { '!=' => { -ident => 'artist.pseudonym' } } },
29 );
30 is_same_sql_bind (
31 $sql,
32 \@bind,
33 "UPDATE ${q}artist${q}
34 SET ${q}artist${q}.${q}name${q} = ${q}artist${q}.${q}pseudonym${q}
35 WHERE ${q}artist${q}.${q}name${q} != ${q}artist${q}.${q}pseudonym${q}
36 ",
37 [],
38 );
39}
40
41done_testing;