From: Peter Rabbitson Date: Tue, 22 Sep 2009 07:55:36 +0000 (+0000) Subject: IN testing support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14190bdf09cf5ac3da6892b0b5b78bcd8eff4eeb;p=scpubgit%2FQ-Branch.git IN testing support --- diff --git a/lib/SQL/Abstract/Test.pm b/lib/SQL/Abstract/Test.pm index cfedf16..7e38ae8 100644 --- a/lib/SQL/Abstract/Test.pm +++ b/lib/SQL/Abstract/Test.pm @@ -59,6 +59,7 @@ my @expression_terminator_sql_keywords = ( # _recurse_parse() my @binary_op_keywords = ( (map { "\Q$_\E" } (qw/< > != = <= >=/)), + '(?: NOT \s+)? IN', '(?: NOT \s+)? LIKE', '(?: NOT \s+)? BETWEEN', ); diff --git a/t/10test.t b/t/10test.t index 41fbc9d..0c51f6a 100644 --- a/t/10test.t +++ b/t/10test.t @@ -268,6 +268,15 @@ my @sql_tests = ( }, { equal => 0, + parenthesis_significant => 1, + statements => [ + q/SELECT foo FROM bar WHERE a IN (1,2,3)/, + q/SELECT foo FROM bar WHERE a IN (1,3,2)/, + q/SELECT foo FROM bar WHERE a IN ((1,2,3))/, + ] + }, + { + equal => 0, statements => [ # BETWEEN with/without parenthesis around itself/RHS is a sticky business # if I made a mistake here, simply rewrite the special BETWEEN handling in