On Thu, Sep 12, 2019 at 11:56 AM Fabien COELHO <coe...@cri.ensmp.fr> wrote: > > > On Wed, Sep 11, 2019 at 10:52:01PM +0200, Fabien COELHO wrote: > >> AFAICR this is because the coverage was not the same:-) Some backslash > >> commands just skip silently to the end of the line, so that intermediate > >> \commands on the same line are not recognized/processed the same, so I > >> moved > >> everything on one line to avoid this. > > > > I see. So basically this tests for more code paths to ignore > > backslash commands and it improves the coverage of \elif. Applied > > after fixing two nits: > > - Indentation was incorrect. > > - Moved the \elif test closer to the existing one for the false > > branch (you can grep #2 to find it). > > Ok. Rebased version added, with some minor changes to improve readability > (comments, variables). > > Few comments: +sub create_test_file +{ + my ($fname, $contents) = @_; + my $fn = $node->basedir . '/' . $fname; + #ok(not -e $fn, "$fn must not already exists"); + append_to_file($fn, $contents); + return $fn; +}
Commented line can be removed +# nope, interacts on tty +#psql('-W', 0, "foo\n", [ qr{^$} ], [ qr{^$} ], 'psql -W'); +psql('-x', 0, "SELECT 1 AS one, 2 AS two;\n", [ qr{one \| 1.*two \| 2}s ], $EMPTY, 'psql -x'); +# some issue, \0 is not welcome somewhere +#psql('-A -z', "SELECT 1 AS one, 2 AS two;\n", [ qr{one.two}s, qr{1.2}s ], $EMPTY, 'psql -z'); +#psql('-A -0', "SELECT 1 AS one, 2 AS two;\n", [ qr{two.1}s ], $EMPTY, 'psql -0'); +psql('-1', 0, "SELECT 54;\nSELECT 32;\n", [ qr{54}, qr{32} ], $EMPTY, 'psql -1'); Commented lines can be removed + [ "\\lo_list\n", [ qr{Large objects} ] ], + [ "\\if true\\q\\endif\n", $EMPTY ], + # ??? + #[ "SELECT md5('hello world');\n\\s\n", [ qr{5eb63bbbe0}, qr{SELECT md5} ] ], + [ "\\set\n", [ qr{ENCODING = }, qr{VERSION_NUM = } ] ], + [ "\\set COMP_KEYWORD_CASE preserve-lower\n\\set COMP_KEYWORD_CASE lower\n" . #[ "Select"] commented line can be removed ??? can be changed to some suitable heading +psql('', 0, "\\s /dev/null\n", $EMPTY, $EMPTY, 'psql \s null'); + +# tab-complation +ipsql('-P pager', 0, 5, + [ # commands tab-complation to be changed to tab-completion + # but the coverage works as expected. + #[ "CREATE \t", qr/i(MATERIALIZED VIEW.*postgres=\# )?/s ], + #[ "\\r\n", qr/Query buffer reset.*postgres=\# /s ], + [ "CREATE \t\\r\n", qr/Query buffer reset.*postgres=\# /s ], + #[ "DROP \t", qr/(UNLOGGED.*postgres=\# )?/s ], + #[ "\\r\n", qr/Query buffer reset.*postgres=\# /s ], + [ "DROP \t\\r\n", qr/Query buffer reset.*postgres=\# /s ], + #[ "ALTER \t", qr/(TABLESPACE.*postgres=\# )/s ], + #[ "\\r\n", qr/Query buffer reset.*postgres=\# /s ], Commented lines can be removed, some more are present below these lines also. Regards, Vignesh EnterpriseDB: http://www.enterprisedb.com