test: Add a simple mcl formatting test
This should definitely get expanded overtime when we can have something decent for formatting mcl code. For now, catch the easy things.
This commit is contained in:
1
test.sh
1
test.sh
@@ -58,6 +58,7 @@ if label-block "basic"; then
|
|||||||
run-testsuite ./test/test-vet.sh
|
run-testsuite ./test/test-vet.sh
|
||||||
run-testsuite ./test/test-misc.sh
|
run-testsuite ./test/test-misc.sh
|
||||||
run-testsuite ./test/test-gofmt.sh
|
run-testsuite ./test/test-gofmt.sh
|
||||||
|
run-testsuite ./test/test-mclfmt.sh
|
||||||
run-testsuite ./test/test-yamlfmt.sh
|
run-testsuite ./test/test-yamlfmt.sh
|
||||||
run-testsuite ./test/test-bashfmt.sh
|
run-testsuite ./test/test-bashfmt.sh
|
||||||
run-testsuite ./test/test-headerfmt.sh
|
run-testsuite ./test/test-headerfmt.sh
|
||||||
|
|||||||
36
test/test-mclfmt.sh
Executable file
36
test/test-mclfmt.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# check for any mcl files that aren't properly formatted
|
||||||
|
# TODO: this is hardly exhaustive
|
||||||
|
|
||||||
|
echo running "$0"
|
||||||
|
set -o errexit
|
||||||
|
#set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
#ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
|
||||||
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
|
cd "${ROOT}"
|
||||||
|
. test/util.sh
|
||||||
|
|
||||||
|
#F="misc/TODO.mcl" # TODO: you can add single files like this...
|
||||||
|
find_files() {
|
||||||
|
# TODO: improve this match if we use txtar for non-mcl things eventually
|
||||||
|
git ls-files | grep -e '\.mcl$' -e '\.txtar$' | grep -v 'misc/TODO.mcl'
|
||||||
|
}
|
||||||
|
|
||||||
|
bad_files=$(
|
||||||
|
#if grep -q '^ ' "$F"; then
|
||||||
|
# echo "$F"
|
||||||
|
#fi
|
||||||
|
for i in $(find_files); do
|
||||||
|
# search for at least one leading space, to ensure we use tabs
|
||||||
|
if grep -q '^ ' "$i"; then
|
||||||
|
echo "$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -n "${bad_files}" ]]; then
|
||||||
|
fail_test "The following mcl files are not properly formatted: ${bad_files}"
|
||||||
|
fi
|
||||||
|
echo 'PASS'
|
||||||
Reference in New Issue
Block a user