Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87e4f24

Browse files
committed
001_libpq_pipeline.pl: use Test::Differences if available
When one of these tests fails to match the trace, this better shows whatthe problem is.Discussion:https://postgr.es/m/20220617183150.ilgokxp22mzywnhh@alvherre.pgsqlReviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
1 parent30a53b7 commit87e4f24

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎src/test/modules/libpq_pipeline/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Test programs and libraries for libpq
2+
3+
If you have Test::Differences installed, any differences in the trace files
4+
are displayed in a format that's easier to read than the standard format.
25
=====================================
36

47
This module was developed to test libpq's "pipeline" mode, but it can

‎src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
use PostgreSQL::Test::Utils;
99
use Test::More;
1010

11+
# Use Test::Differences if installed, and select unified diff output.
12+
# No decent way to select a context line count with this;
13+
# we could use a sub ref to allow that.
14+
BEGIN
15+
{
16+
#<<< protect next line from pgperltidy
17+
if (!evalq{ use Test::Differences; unified_diff(); 1})## no critic (ProhibitStringyEval)
18+
#>>>
19+
{
20+
*eq_or_diff = \&is;
21+
}
22+
}
23+
1124
my$node = PostgreSQL::Test::Cluster->new('main');
1225
$node->init;
1326
$node->start;
@@ -55,7 +68,7 @@
5568
$result = slurp_file_eval($traceout);
5669
nextunless$resultne"";
5770

58-
is($result,$expected,"$testname trace match");
71+
eq_or_diff($result,$expected,"$testname trace match");
5972
}
6073
}
6174

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp