Skip to content

Commit 56a3921

Browse files
committed
Further fixes for tab-completion TAP tests.
Escape non-printable characters in failure reports, by using Data::Dumper in Useqq mode. Also, bump $Test::Builder::Level so the diagnostic references the calling line, and use diag() instad of note(), so it shows even in non-verbose mode (per request from Christoph Berg). Also, give up on trying to test for the specific way that readline chooses to overwrite existing text in the \DRD -> \drds test. There are too many variants, it seems, at least on the libedit side of things. Dagfinn Ilmari Mannsåker and Tom Lane Discussion: https://postgr.es/m/20200103110128.GA28967@msg.df7cb.de
1 parent ddd87d5 commit 56a3921

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/bin/psql/t/010_tab_completion.pl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use TestLib;
66
use Test::More;
77
use IPC::Run qw(pump finish timer);
8+
use Data::Dumper;
89

910
if (!defined($ENV{with_readline}) || $ENV{with_readline} ne 'yes')
1011
{
@@ -52,6 +53,9 @@ sub check_completion
5253
{
5354
my ($send, $pattern, $annotation) = @_;
5455

56+
# report test failures from caller location
57+
local $Test::Builder::Level = $Test::Builder::Level + 1;
58+
5559
# reset output collector
5660
$out = "";
5761
# restart per-command timer
@@ -63,7 +67,9 @@ sub check_completion
6367
my $okay = ($out =~ m/$pattern/ && !$timer->is_expired);
6468
ok($okay, $annotation);
6569
# for debugging, log actual output if it didn't match
66-
note 'Actual output was "' . $out . "\"\n" if !$okay;
70+
local $Data::Dumper::Terse = 1;
71+
local $Data::Dumper::Useqq = 1;
72+
diag 'Actual output was ' . Dumper($out) . "\n" if !$okay;
6773
return;
6874
}
6975

@@ -105,11 +111,9 @@ sub clear_query
105111
clear_query();
106112

107113
# check case-sensitive keyword replacement
108-
# XXX the output here might vary across readline versions
109-
check_completion(
110-
"\\DRD\t",
111-
"\\DRD\b\b\bdrds ",
112-
"complete \\DRD<tab> to \\drds");
114+
# note: various versions of readline/libedit handle backspacing
115+
# differently, so just check that the replacement comes out correctly
116+
check_completion("\\DRD\t", "drds ", "complete \\DRD<tab> to \\drds");
113117

114118
clear_query();
115119

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy