[build] Added ability to test each function for syntax error by piping it through bash

This commit is contained in:
ayakael 2018-05-18 12:30:24 -07:00
parent 2741e72574
commit 7b9f56f5d3
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -1,6 +1,18 @@
#!/bin/bash
EXEC=dam
test_function() {
functionList=(${@})
for function in ${functionList[@]}; do
echo -e "#!/bin/bash\n" > .test.sh
awk '!/^ *#/ && NF' src/env >> .test.sh
awk '!/^ *#/ && NF' ${function} >> .test.sh
bash .test.sh
rm .test.sh
done
}
gen_help() {
for file in $(find help/ -type f -printf "%P\n"); do
echo -e "
@ -31,6 +43,8 @@ gen_parser() {
awk '!/^ *#/ && NF' src/parser
}
test_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}
gen_env > ${EXEC}
gen_help >> ${EXEC}
gen_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}