Start working on update clause
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 900_errors.t
index f885a89..b86eda0 100644 (file)
@@ -1,9 +1,17 @@
 use strict;
 use warnings;
 
-use Test::More tests => 5;
+use Test::More tests => 6;
 use Test::Exception;
 
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Test::SQL::Abstract::Util qw/
+  mk_name
+  mk_value
+  mk_alias
+/;
+
 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
 
 my $sqla = SQL::Abstract->create(1);
@@ -25,6 +33,7 @@ throws_ok {
   )
 } qr/^'~' is not a valid operator in an expression/;
 
+{
 local $TODO = "Work out how to get nice errors for these";
 
 throws_ok {
@@ -39,3 +48,16 @@ throws_ok {
   )
 } qr/foobar/, "alias: iden instead of ident";
 
+}
+
+throws_ok {
+  $sqla->dispatch(
+    { -type => 'update',
+      tablespec => mk_name('test'),
+      columns => [
+        mk_name(qw/me id/),
+        mk_alias(mk_name(qw/foo id/) ,'foo_id')
+      ]
+    }
+  )
+} qr/^'values' is required in update AST/, "Invalid clause in update"