tab complete regress tests

Started by Pavel Stehuleover 9 years ago3 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hi

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

I found only this link

http://stackoverflow.com/questions/22795767/how-to-test-python-readline-completion

Regards

Pavel

#2Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Pavel Stehule (#1)
Re: tab complete regress tests

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

http://stackoverflow.com/questions/22795767/how-to-test-python-readline-completion

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

Regards,

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Pavel Stehule (#1)
Re: tab complete regress tests

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers