Skip to content

Commit 379f0e9

Browse files
Check for tabs in postgresql.conf.sample.
The previous commit updated this file to use spaces instead of tabs. This commit adds a test to ensure that no new tabs are added. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/aReNUKdMgKxLqmq7%40nathan
1 parent f63ae72 commit 379f0e9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/modules/test_misc/t/003_check_guc.pl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,21 @@
4444
# List of all the GUCs found in the sample file.
4545
my @gucs_in_file;
4646

47+
# List of all lines with tabs in the sample file.
48+
my @lines_with_tabs;
49+
4750
# Read the sample file line-by-line, checking its contents to build a list
4851
# of everything known as a GUC.
4952
my $num_tests = 0;
53+
my $line_num = 0;
5054
open(my $contents, '<', $sample_file)
5155
|| die "Could not open $sample_file: $!";
5256
while (my $line = <$contents>)
5357
{
58+
$line_num++;
59+
push @lines_with_tabs, $line_num
60+
if $line =~ /\t/;
61+
5462
# Check if this line matches a GUC parameter:
5563
# - Each parameter is preceded by "#", but not "# " in the sample
5664
# file.
@@ -97,6 +105,8 @@
97105
is(scalar(@sample_intersect),
98106
0, "no parameters marked as NOT_IN_SAMPLE in postgresql.conf.sample");
99107

108+
is(scalar(@lines_with_tabs), 0, "no lines with tabs in postgresql.conf.sample");
109+
100110
# These would log some information only on errors.
101111
foreach my $param (@missing_from_file)
102112
{
@@ -116,5 +126,9 @@
116126
"found GUC $param in postgresql.conf.sample, marked as NOT_IN_SAMPLE\n"
117127
);
118128
}
129+
foreach my $param (@lines_with_tabs)
130+
{
131+
print("found tab in line $param in postgresql.conf.sample\n");
132+
}
119133

120134
done_testing();

0 commit comments

Comments
 (0)