use Test::More;
use Test::Warn;
use Test::Exception;
-use SQL::Abstract::Test import => [qw(is_same_sql_bind diag_where)];
+use SQL::Abstract::Test import => [qw(is_same_sql_bind diag_where dumper)];
use SQL::Abstract;
throws => qr/Argument passed to the 'IN' operator can not be undefined/,
test => '-in with undef argument',
},
+
+ {
+ where => { -in => [42] },
+ throws => qr/Illegal use of top-level '-in'/,
+ test => 'Top level -in',
+ },
+ {
+ where => { -between => [42, 69] },
+ throws => qr/Illegal use of top-level '-between'/,
+ test => 'Top level -between',
+ },
);
for my $case (@in_between_tests) {
my $sql = SQL::Abstract->new ($case->{args} || {});
if (my $e = $case->{throws}) {
- throws_ok { $sql->where($case->{where}) } $e, "$label throws correctly";
+ my $stmt;
+ throws_ok { ($stmt) = $sql->where($case->{where}) } $e, "$label throws correctly"
+ or diag dumper ({ where => $case->{where}, result => $stmt });
}
else {
my ($stmt, @bind);