Get select sort of working again
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 200_join.t
CommitLineData
704c5138 1use strict;
2use warnings;
3
cbcfedc1 4use Test::More tests => 3;
704c5138 5use Test::Differences;
6
7use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
8
9my $sqla = SQL::Abstract->create(1);
10
11is $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 26is $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";