Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available
От | Alvaro Herrera |
---|---|
Тема | Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available |
Дата | |
Msg-id | 20230309094502.heamw6al2vkjr4yw@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: pgsql: 001_libpq_pipeline.pl: use Test::Differences if available
|
Список | pgsql-committers |
On 2023-Mar-08, Andrew Dunstan wrote: > 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 $@; Hmm, I just grabbed the code from the Test::Differences manual, but I agree that avoiding the stringy eval is better. Let me try it out. > I wonder if it's worth centralizing this. I had a look around to see what might benefit from this. At first I thought the ugly pg_dump test would, but it doesn't because it uses like/unlike, not 'is'. Same with PostgreSQL::Test::Utils' command_like and such: AFAICS they are all matching stdout on regexps. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "El que vive para el futuro es un iluso, y el que vive para el pasado, un imbécil" (Luis Adler, "Los tripulantes de la noche")
В списке pgsql-committers по дате отправления: