Updates to MX::Declare required changes
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / compat / ast / 02update.t
1 use strict;
2 use warnings;
3
4 use FindBin;
5 use lib "$FindBin::Bin/../../lib";
6 use Test::SQL::Abstract::Util qw/
7   mk_name
8   mk_value
9   field_op_value
10   :dumper_sort
11 /;
12
13 use SQL::Abstract::Compat;
14
15 use Test::More tests => 3;
16 use Test::Differences;
17
18 ok(my $visitor = SQL::Abstract::Compat->new);
19
20
21 eq_or_diff
22   $visitor->update_ast('test', { foo => 1 }),
23   { -type => 'update',
24     tablespec => mk_name('test'),
25     columns => [
26       mk_name('foo')
27     ],
28     values => [
29       mk_value(1)
30     ]
31   },
32   "simple update";
33
34 eq_or_diff
35   $visitor->update_ast('test', { foo => 1 }, { id => 2 }),
36   { -type => 'update',
37     tablespec => mk_name('test'),
38     columns => [
39       mk_name('foo')
40     ],
41     values => [
42       mk_value(1)
43     ],
44     where => field_op_value('id' => '==', 2)
45   },
46   "simple update";
47
48
49
50
51