dbddb1c6257f75927b52f02961a93a73db5a48ea
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 900_errors.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     { -type => 'expr', op => '==',
14       args => [
15         { -type => 'name', args => [qw/me id/] },
16         { -type => 'alias', ident => { -type => 'name', args => [qw/me id/] }, as => 'bar' }
17       ]
18     }
19   )
20 } qr/^'alias' is not a valid AST type in an expression/, "Error from invalid part in where";
21
22 throws_ok {
23   $sqla->dispatch(
24     { -type => 'expr', op => '~' }
25   )
26 } qr/^'~' is not a valid operator in an expression/
27