X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F14roundtrippin.t;h=9dc581e642898b62c52ca164d20e2bedeb90db20;hb=7d27345242d34aa0ad38e3a5f54d0bd09b558d32;hp=981297e0538c76f208135369f0a9d5547d537039;hpb=1ba9d0f03ee2573587fdd72f7465926e978d6be1;p=scpubgit%2FQ-Branch.git diff --git a/t/14roundtrippin.t b/t/14roundtrippin.t index 981297e..9dc581e 100644 --- a/t/14roundtrippin.t +++ b/t/14roundtrippin.t @@ -53,8 +53,8 @@ for my $orig (@sql) { $sqlat->unparse($ast); }; - # deal with parenthesis readjustment - $_ =~ s/\s*([\(\)])\s*/$1 /g + # deal with whitespace around parenthesis readjustment + $_ =~ s/ \s* ( [ \(\) ] ) \s* /$1/gx for ($orig, $reassembled); is ( @@ -69,6 +69,15 @@ for my $orig (@sql) { }; } +# this is invalid SQL, we are just checking that the parser +# does not inadvertently make it right +my $sql = 'SELECT * FROM foo WHERE x IN ( ( 1 ) )'; +is( + $sqlat->unparse($sqlat->parse($sql)), + $sql, + 'Multi-parens around IN survive', +); + lives_ok { $sqlat->unparse( $sqlat->parse( <<'EOS' ) ) } 'Able to parse/unparse grossly malformed sql'; SELECT (