[build] Added ability to test each function for syntax error by piping it through bash
This commit is contained in:
parent
2741e72574
commit
7b9f56f5d3
1 changed files with 14 additions and 0 deletions
14
build.sh
14
build.sh
|
@ -1,6 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
EXEC=dam
|
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() {
|
gen_help() {
|
||||||
for file in $(find help/ -type f -printf "%P\n"); do
|
for file in $(find help/ -type f -printf "%P\n"); do
|
||||||
echo -e "
|
echo -e "
|
||||||
|
@ -31,6 +43,8 @@ gen_parser() {
|
||||||
awk '!/^ *#/ && NF' src/parser
|
awk '!/^ *#/ && NF' src/parser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}
|
||||||
|
|
||||||
gen_env > ${EXEC}
|
gen_env > ${EXEC}
|
||||||
gen_help >> ${EXEC}
|
gen_help >> ${EXEC}
|
||||||
gen_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}
|
gen_function $(find src/ -type f -not -name env -not -name parser) >> ${EXEC}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue