diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2023-10-06 11:52:05 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2023-10-06 11:56:19 +0200 |
commit | ffb69b23115a1ca1d81f7e273d50b75154ae7b0b (patch) | |
tree | 7dc30f2268053b0f1c38a1d46a91ef76bfb663fb | |
parent | b4336515b0803b83a4d8f102006986e5863d2c49 (diff) | |
download | postgresql-ffb69b23115a1ca1d81f7e273d50b75154ae7b0b.tar.gz postgresql-ffb69b23115a1ca1d81f7e273d50b75154ae7b0b.zip |
Add test for checking the line length of --help output
There was some discussion what the line length should be. Most output
currently clearly targets around 80 columns, but the maximum in use
currently is 95, so we set that as the current maximum. This just
ensures that there is some guidance and there are no wild deviations.
based on patch by Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Discussion: https://www.postgresql.org/message-id/flat/50ca8ff35a8dd8f9ec89963b503571a7@oss.nttdata.com
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Utils.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index d66fe1cf453..cd86897580c 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -884,6 +884,15 @@ sub program_help_ok ok($result, "$cmd --help exit code 0"); isnt($stdout, '', "$cmd --help goes to stdout"); is($stderr, '', "$cmd --help nothing to stderr"); + + # This value isn't set in stone, it reflects the current + # convention in use. Most output actually tries to aim for 80. + my $max_line_length = 95; + my @long_lines = grep { length > $max_line_length } split /\n/, $stdout; + is(scalar @long_lines, 0, "$cmd --help maximum line length") + or diag("These lines are too long (>$max_line_length):\n", + join("\n", @long_lines)); + return; } |