openrc/test/check-spacing-style.sh
William Hubbs fdfa6dbb0e
rewrite tests (#515)
* rewrite tests to work with meson

This ports our tests to meson and makes them able to be run in parallel.

* add tests to ci

* rewrite test/check-trailing-newlines in bash

This test was using a GNU sed command which does not work on Alpine Linux.
2022-04-16 15:13:08 -05:00

19 lines
415 B
Bash

#!/bin/sh
top_srcdir=${SOURCE_ROOT:-..}
. ${top_srcdir}/test/setup_env.sh
ebegin "Checking spacing style"
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
! -name queue.h \
-exec grep -n -E \
-e '\<(for|if|switch|while)\(' \
-e '\<(for|if|switch|while) \( ' \
-e ' ;' \
-e '[[:space:]]$' \
-e '\){' \
-e '(^|[^:])//' \
{} +)
[ -z "${out}" ]
eend $? "These lines violate style rules:"$'\n'"${out}"