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