X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05in_between.t;h=14c8f4e9fac53ab38f6c731380d3d70ca25a1721;hb=3bea90ab6c0aebaa1bec690da5c11b5ef417d2bc;hp=11119984faa88d2cb607122f1be6828fa396f3f5;hpb=db8e4588960f73fc9da7994bc3021821b3b17334;p=scpubgit%2FQ-Branch.git diff --git a/t/05in_between.t b/t/05in_between.t index 1111998..14c8f4e 100644 --- a/t/05in_between.t +++ b/t/05in_between.t @@ -174,6 +174,17 @@ my @in_between_tests = ( bind => [], test => '-in multi-line subquery test', }, + + # check that the outer paren opener is not too agressive + # note: this syntax *is not legal* on SQLite (maybe others) + # see end of https://rt.cpan.org/Ticket/Display.html?id=99503 + { + where => { foo => { -in => \ '(SELECT 1) UNION (SELECT 2)' } }, + stmt => 'WHERE foo IN ( (SELECT 1) UNION (SELECT 2) )', + bind => [], + test => '-in paren-opening works on balanced pairs only', + }, + { where => { customer => { -in => \[ @@ -266,6 +277,17 @@ my @in_between_tests = ( 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) { @@ -274,7 +296,7 @@ for my $case (@in_between_tests) { local $SQL::Abstract::Test::parenthesis_significant = $case->{parenthesis_significant}; my $label = $case->{test} || 'in-between test'; - my $sql = SQL::Abstract->new ($case->{args} || {}); + my $sql = SQL::Abstract->new($case->{args} || {}); if (my $e = $case->{throws}) { my $stmt;