pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ilmari@ilmari.org
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Date: Fri, 03 Jan 2020 17:12:09 +0000
Message-ID: <87o8vk1n2u.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <14261.1578060227@sss.pgh.pa.us>
References: <E1in6ft-0004zR-6l@gemulon.postgresql.org>
	<20200103110128.GA28967@msg.df7cb.de>
	<14261.1578060227@sss.pgh.pa.us>

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

Attachments:

  [text/x-diff] 0001-Escape-non-printable-characters-in-psql-tab-completi.patch (0B, ../87o8vk1n2u.fsf@wibble.ilmari.org/2-0001-Escape-non-printable-characters-in-psql-tab-completi.patch)
  download

view thread (64+ messages)  latest in thread

Message-ID: <87o8vk1n2u.fsf@wibble.ilmari.org>
Permalink:  ../87o8vk1n2u.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/87o8vk1n2u.fsf@wibble.ilmari.org

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: ilmari@ilmari.org, tgl@sss.pgh.pa.us, myon@debian.org, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
  In-Reply-To: <87o8vk1n2u.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox