f6544bcf146d5f38beed12b822f40d8a1204f707
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 202_update.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 5;
5 use Test::Differences;
6
7 use FindBin;
8 use lib "$FindBin::Bin/lib";
9 use Test::SQL::Abstract::Util qw/
10   mk_name
11   mk_value
12   mk_alias
13   :dumper_sort
14 /;
15
16 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
17
18 my $sqla = SQL::Abstract->create(1);
19
20 is $sqla->dispatch(
21   { -type => 'update',
22     tablespec => mk_name('test'),
23     columns => [
24       mk_name(qw/me id/),
25       mk_name(qw/hostname/),
26     ],
27     values => [
28       mk_expr('+', mk_name(qw/me id/), mk_value(5)),
29       mk_value('localhost'),
30     ]
31   }
32 ), "UPDATE test SET me.id = me.id + 5, hostnameme = localhost"
33    "update clause";