aboutsummaryrefslogtreecommitdiff
path: root/test/check-trailing-newlines.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/check-trailing-newlines.sh')
-rwxr-xr-xtest/check-trailing-newlines.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/check-trailing-newlines.sh b/test/check-trailing-newlines.sh
new file mode 100755
index 00000000..4c99e761
--- /dev/null
+++ b/test/check-trailing-newlines.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+top_srcdir=${SOURCE_ROOT:-..}
+. ${top_srcdir}/test/setup_env.sh
+
+ebegin "Checking trailing newlines in code"
+out=$(cd ${top_srcdir};
+ for f in $(find */ -name '*.[ch]') ; do
+ while read -r line; do
+ if [ -n "${line}" ]; then
+ blankline=
+ else
+ blankline=1
+ fi
+ done < "${f}"
+ [ -n "${blankline}" ] && printf "%s\n" "${f}"
+ done)
+[ -z "${out}" ]
+eend $? "Trailing newlines need to be deleted:"$'\n'"${out}"