Re: tab complete regress tests

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tab complete regress tests
Date: 2016-12-31 16:08:18
Message-ID: 5112bd38-a30f-dfc1-021d-276327640576@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-12-31 16:17:02 Re: DROP FUNCTION of multiple functions
Previous Message Fabrízio de Royes Mello 2016-12-31 15:38:38 Re: tab complete regress tests