Create ArrayAST, HashAST and AST types in a type library so that some constructs...
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 200_join.t
index 2e89ebc..176ab81 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More tests => 3;
 use Test::Differences;
 
 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
@@ -9,10 +9,17 @@ use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
 my $sqla = SQL::Abstract->create(1);
 
 is $sqla->dispatch(
-  [ -join =>
-      [-name => qw/foo/],
-      [ '==', [-name => qw/foo id/], [ -name => qw/me foo_id/ ] ]
-  ]
+  { -type => 'join',
+    tablespec => [-name => qw/foo/],
+    on => [ '==', [-name => qw/foo id/], [ -name => qw/me foo_id/ ] ],
+  }
 ), "JOIN foo ON (foo.id = me.foo_id)", 
    "simple join clause";
 
+is $sqla->dispatch(
+  { -type => 'join',
+    tablespec => [-alias => [-name => qw/foo/], 'bar' ],
+    using => [ -name => qw/foo_id/ ]
+  }
+), "JOIN foo AS bar USING (foo_id)", 
+   "using join clause";