Use seperate dispatch table for where to top level
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 101_where_error.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 3;
5 use Test::Exception;
6
7 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
8
9 my $sqla = SQL::Abstract->create(1);
10
11 throws_ok {
12   $sqla->dispatch(
13     [ -where => 
14       [ '==', [-name => qw/me id/], [ -alias => [-name => qw/me foo/], 'bar' ] ]
15     ]
16   )
17 } qr/^'-alias' is not a valid clause in a where AST/, "Error from invalid part in where";
18
19 throws_ok {
20   $sqla->dispatch(
21     [ -where => 
22       [ '~', [-name => qw/me id/], [ -alias => [-name => qw/me foo/], 'bar' ] ]
23     ]
24   )
25 } qr/^'~' is not a valid operator/, 
26   "Error from invalid operator in where";