Thread: [HACKERS] tab complete regress tests

[HACKERS] tab complete regress tests

From
Pavel Stehule
Date:
Hi

now the code in tabcomplete become large part of psql. Is there some possibility to write regress tests? 

I found only this link


Regards

Pavel

Re: [HACKERS] tab complete regress tests

From
Fabrízio de Royes Mello
Date:

Em sáb, 31 de dez de 2016 às 07:11, Pavel Stehule <pavel.stehule@gmail.com> escreveu:
Hi

now the code in tabcomplete become large part of psql. Is there some possibility to write regress tests? 

I found only this link


Isn't possible implement it using our current perl TAP infrastructure?

Regards,

Re: [HACKERS] tab complete regress tests

From
Peter Eisentraut
Date:
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