test: improve admotion test by skipping empty lines

This commit is contained in:
Matthias
2025-05-17 16:16:19 +02:00
parent 09b687d66f
commit daff50e79e

View File

@@ -8,14 +8,32 @@ format_issues=$?
failed=0
# Check for the presence of the "!!!" or "???" markers in the files
# the consecutive non-empty line must begin with 4 spaces
while read -r file; do
awk -v fname="$file" '
/^(!!!|\?\?\?)/ {
current_line_number = NR
current_line = $0
if (getline nextLine <= 0 || nextLine !~ /^ /) {
found_next_content = 0
while (getline nextLine > 0) {
# Skip empty lines
if (nextLine ~ /^$/) {
continue
}
found_next_content = 1
if (nextLine !~ /^ /) {
print "File:", fname
print "Error in Line ", current_line_number, "Expected next non-empty line to start with 4 spaces"
print ">>", current_line
print "------"
exit 1
}
break
}
if (!found_next_content) {
print "File:", fname
print "Error in Line ", current_line_number, "Expected next line to start with 4 spaces"
print "Error in Line ", current_line_number, "Found marker but no content following it"
print ">>", current_line
print "------"
exit 1