Re: pgsql: Add basic TAP tests for psql's tab-completion logic.

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker )
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christoph Berg <myon@debian.org>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-01-03T17:12:09Z
Lists: pgsql-hackers

Attachments

Tom Lane <tgl@sss.pgh.pa.us> writes:

> Also, while I'm asking for Perl advice: I can see in my editor that
> there's a control-G bell character in that string, but this is far
> from obvious on the web page.  I'd kind of like to get the report
> to escapify control characters so that what comes out is more like
>
> 	# Actual output was "\DRD^G"
> or
> 	# Actual output was "\\DRD\007"
>
> or some such.  Anybody know an easy way to do that in Perl?

I was going to suggest using Test::More's like() function to do the
regex check, but sadly that only escapes things that would break the TAP
stream syntax, not non-printables in general.  The next obvious thing is
Data::Dumper with the 'Useqq' option enabled, which makes it use
double-quoted-string escapes (e.g. "\a" for ^G).

The attaced patch does that, and also bumps $Test::Builder::Level so the
diagnostic references the calling line, and uses diag() instad of
note(), so it shows even in non-verbose mode.

- ilmari
-- 
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen

Commits

  1. Skip tab-completion tests if envar SKIP_READLINE_TESTS is defined.

  2. Minor style improvements for tab-completion test.

  3. Avoid reading ~/.inputrc in tab-completion test, and revert other changes.

  4. Don't try to force TERM to a fixed value in tab-completion test.

  5. In tab-completion test, print out the value of TERM before changing it.

  6. Make tab-completion tests more robust.

  7. Further fixes for tab-completion TAP tests.

  8. Add an ugly workaround for a bug in some recent libedit versions.

  9. Add basic TAP tests for psql's tab-completion logic.

  10. Fix running out of file descriptors for spill files.