tests: Trim newline from result returned by BackgroundPsql->query
authorHeikki Linnakangas <[email protected]>
Thu, 27 Jun 2024 18:06:27 +0000 (21:06 +0300)
committerHeikki Linnakangas <[email protected]>
Thu, 27 Jun 2024 18:09:06 +0000 (21:09 +0300)
This went unnoticed, because only a few existing callers of
BackgroundPsql->query used the result, and the ones that did were not
bothered by an extra newline. I noticed because I was about to add a
new test that checks the result.

Backport to all supported versions, since I just backported the
BackgroundPsql facility to all supported versions too.

src/test/perl/PostgreSQL/Test/BackgroundPsql.pm

index 5c925c319023ae46cee58deabb1f723e048801d1..9878bedef88e7cae04ed8f0755c81dc018e8c622 100644 (file)
@@ -223,7 +223,7 @@ sub query
    $output = $self->{stdout};
 
    # remove banner again, our caller doesn't care
-   $output =~ s/\n$banner$//s;
+   $output =~ s/\n$banner\n$//s;
 
    # clear out output for the next query
    $self->{stdout} = '';