test: improve admotion test by skipping empty lines
This commit is contained in:
+20
-2
@@ -8,14 +8,32 @@ format_issues=$?
|
|||||||
|
|
||||||
failed=0
|
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
|
while read -r file; do
|
||||||
awk -v fname="$file" '
|
awk -v fname="$file" '
|
||||||
/^(!!!|\?\?\?)/ {
|
/^(!!!|\?\?\?)/ {
|
||||||
current_line_number = NR
|
current_line_number = NR
|
||||||
current_line = $0
|
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 "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 ">>", current_line
|
||||||
print "------"
|
print "------"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user