pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available
Date: Wed, 8 Mar 2023 17:13:00 -0500
Message-ID: <7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net> (raw)
In-Reply-To: <E1pZxoB-002Xj2-5E@gemulon.postgresql.org>
References: <E1pZxoB-002Xj2-5E@gemulon.postgresql.org>


On 2023-03-08 We 12:42, Alvaro Herrera wrote:
> 001_libpq_pipeline.pl: use Test::Differences if available
>
> When one of these tests fails to match the trace, this better shows what
> the problem is.
>
> Discussion: https://postgr.es/m/20220617183150.ilgokxp22mzywnhh@alvherre.pgsql
> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>


I don't think you need a stringy eval here, and they are something to be 
avoided in general. If you use `require` instead of `use` it should be 
unnecessary, and you can avoid all the perltidy ugliness.

something like this should do the trick:


    eval { require Test::Differences; Test::Differences->import; 
unified_diff; 1; };

    *eq_or_diff = \&is if $@;


I wonder if it's worth centralizing this.


cheers


andrew


-- 

Andrew Dunstan
EDB: https://www.enterprisedb.com






view thread (4+ messages)  latest in thread

Message-ID: <7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net>
Permalink:  ../7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net/
Also on:    postgresql.org/message-id/7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, alvherre@alvh.no-ip.org
  Subject: Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available
  In-Reply-To: <7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net>
  References: <E1pZxoB-002Xj2-5E@gemulon.postgresql.org> <7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net>

* 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