Skip to content

Commit daff50e

Browse files
committed
test: improve admotion test by skipping empty lines
1 parent 09b687d commit daff50e

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

tests/test_docs.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,32 @@ format_issues=$?
88

99
failed=0
1010

11+
# Check for the presence of the "!!!" or "???" markers in the files
12+
# the consecutive non-empty line must begin with 4 spaces
1113
while read -r file; do
1214
awk -v fname="$file" '
1315
/^(!!!|\?\?\?)/ {
1416
current_line_number = NR
1517
current_line = $0
16-
if (getline nextLine <= 0 || nextLine !~ /^ /) {
18+
found_next_content = 0
19+
while (getline nextLine > 0) {
20+
# Skip empty lines
21+
if (nextLine ~ /^$/) {
22+
continue
23+
}
24+
found_next_content = 1
25+
if (nextLine !~ /^ /) {
26+
print "File:", fname
27+
print "Error in Line ", current_line_number, "Expected next non-empty line to start with 4 spaces"
28+
print ">>", current_line
29+
print "------"
30+
exit 1
31+
}
32+
break
33+
}
34+
if (!found_next_content) {
1735
print "File:", fname
18-
print "Error in Line ", current_line_number, "Expected next line to start with 4 spaces"
36+
print "Error in Line ", current_line_number, "Found marker but no content following it"
1937
print ">>", current_line
2038
print "------"
2139
exit 1

0 commit comments

Comments
 (0)