Skip to content

Commit 09b687d

Browse files
committed
test: add test checking proper admotion logic
1 parent 665ff9f commit 09b687d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/test_docs.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,31 @@
44
# !!! <TYPE> "title" - Title needs to be quoted!
55
# Same for ???
66
grep -Er '^(!{3}|\?{3})\s\S+:|^(!{3}|\?{3})\s\S+\s[^"]' docs/*
7+
format_issues=$?
78

8-
if [ $? -ne 0 ]; then
9+
failed=0
10+
11+
while read -r file; do
12+
awk -v fname="$file" '
13+
/^(!!!|\?\?\?)/ {
14+
current_line_number = NR
15+
current_line = $0
16+
if (getline nextLine <= 0 || nextLine !~ /^ /) {
17+
print "File:", fname
18+
print "Error in Line ", current_line_number, "Expected next line to start with 4 spaces"
19+
print ">>", current_line
20+
print "------"
21+
exit 1
22+
}
23+
}
24+
' "$file"
25+
26+
if [ $? -ne 0 ]; then
27+
failed=1
28+
fi
29+
done < <(find . -type f -name "*.md")
30+
31+
if [ $format_issues -eq 1 ] && [ $failed -eq 0 ]; then
932
echo "Docs test success."
1033
exit 0
1134
fi

0 commit comments

Comments
 (0)