Re: [HACKERS] tab complete regress tests - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] tab complete regress tests
Date
Msg-id 5112bd38-a30f-dfc1-021d-276327640576@2ndquadrant.com
Whole thread Raw
In response to [HACKERS] tab complete regress tests  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 12/31/16 4:09 AM, Pavel Stehule wrote:
> now the code in tabcomplete become large part of psql. Is there some
> possibility to write regress tests? 

I started on that a while ago with some Perl Expect module.  The use of
the module was a bit cumbersome, but it worked OK.

The problem is that you end up just writing out another copy of
tab-complete.c in a different language.  So, for example, to test
   else if (Matches4("ALTER", "DOMAIN", MatchAny, "SET"))       COMPLETE_WITH_LIST3("DEFAULT", "NOT NULL", "SCHEMA");

the test code would effectively look like
   test_completion(["ALTER", "DOMAIN", random_string(), "SET"],                   ["DEFAULT, "NOT NULL", "SCHEMA"]);

That's not very interesting, and the regressions are more likely in
keeping the test code up to date than in actual behavior changes.

I do agree that having some tests would be good, because we're now so
used to having tests that reviewing tab completion changes becomes
strangely manual.  But I don't have a good idea how to structure those
tests efficiently.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: [HACKERS] tab complete regress tests
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] DROP FUNCTION of multiple functions