176ab81c37af9a6c021b655a6c66dd43395854c0
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 200_join.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 3;
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(
12   { -type => 'join',
13     tablespec => [-name => qw/foo/],
14     on => [ '==', [-name => qw/foo id/], [ -name => qw/me foo_id/ ] ],
15   }
16 ), "JOIN foo ON (foo.id = me.foo_id)", 
17    "simple join clause";
18
19 is $sqla->dispatch(
20   { -type => 'join',
21     tablespec => [-alias => [-name => qw/foo/], 'bar' ],
22     using => [ -name => qw/foo_id/ ]
23   }
24 ), "JOIN foo AS bar USING (foo_id)", 
25    "using join clause";