Commit | Line | Data |
704c5138 |
1 | use strict; |
2 | use warnings; |
3 | |
cbcfedc1 |
4 | use Test::More tests => 3; |
704c5138 |
5 | use Test::Differences; |
6 | |
7 | use_ok('SQL::Abstract') or BAIL_OUT( "$@" ); |
8 | |
9 | my $sqla = SQL::Abstract->create(1); |
10 | |
11 | is $sqla->dispatch( |
cbcfedc1 |
12 | { -type => 'join', |
747f7c21 |
13 | tablespec => {-type => name => args => [qw/foo/]}, |
14 | on => { |
15 | -type => 'expr', |
16 | op => '==', |
17 | args => [ |
18 | { -type => 'name', args => [qw/foo id/] }, |
19 | { -type => 'name', args => [qw/me foo_id/] }, |
20 | ] |
21 | } |
cbcfedc1 |
22 | } |
704c5138 |
23 | ), "JOIN foo ON (foo.id = me.foo_id)", |
24 | "simple join clause"; |
25 | |
cbcfedc1 |
26 | is $sqla->dispatch( |
27 | { -type => 'join', |
747f7c21 |
28 | tablespec => {-type => 'alias', ident => {-type => name => args => [qw/foo/]}, as => 'bar' }, |
29 | using => { -type => 'name', args => [qw/foo_id/] }, |
cbcfedc1 |
30 | } |
31 | ), "JOIN foo AS bar USING (foo_id)", |
32 | "using join clause"; |