diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-01-03 12:54:13 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-01-03 12:54:13 -0500 |
commit | 56a3921a2f5102f804bd0ff741e144a0e6f1c0b6 (patch) | |
tree | a6a2099c4c0b0e560b52efa18f897d5d0ca9abc7 /src | |
parent | ddd87d564508bb1c80aac0a4439cfe74a3c203a9 (diff) | |
download | postgresql-56a3921a2f5102f804bd0ff741e144a0e6f1c0b6.tar.gz postgresql-56a3921a2f5102f804bd0ff741e144a0e6f1c0b6.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/t/010_tab_completion.pl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index a02cbd8e476..96221f81481 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -5,6 +5,7 @@ use PostgresNode; use TestLib; use Test::More; use IPC::Run qw(pump finish timer); +use Data::Dumper; if (!defined($ENV{with_readline}) || $ENV{with_readline} ne 'yes') { @@ -52,6 +53,9 @@ sub check_completion { my ($send, $pattern, $annotation) = @_; + # report test failures from caller location + local $Test::Builder::Level = $Test::Builder::Level + 1; + # reset output collector $out = ""; # restart per-command timer @@ -63,7 +67,9 @@ sub check_completion my $okay = ($out =~ m/$pattern/ && !$timer->is_expired); ok($okay, $annotation); # for debugging, log actual output if it didn't match - note 'Actual output was "' . $out . "\"\n" if !$okay; + local $Data::Dumper::Terse = 1; + local $Data::Dumper::Useqq = 1; + diag 'Actual output was ' . Dumper($out) . "\n" if !$okay; return; } @@ -105,11 +111,9 @@ check_completion("2\t", "246 ", clear_query(); # check case-sensitive keyword replacement -# XXX the output here might vary across readline versions -check_completion( - "\\DRD\t", - "\\DRD\b\b\bdrds ", - "complete \\DRD<tab> to \\drds"); +# note: various versions of readline/libedit handle backspacing +# differently, so just check that the replacement comes out correctly +check_completion("\\DRD\t", "drds ", "complete \\DRD<tab> to \\drds"); clear_query(); |