Write .bash version of .bats to /tmp

This commit is contained in:
Tim Byrne 2017-01-05 16:29:36 -06:00
parent c4f2141e35
commit 06757b3544
No known key found for this signature in database
GPG Key ID: 6CBE24C2FD8CF76E
1 changed files with 5 additions and 4 deletions

View File

@ -26,11 +26,12 @@ shellcheck:
@echo Running shellcheck @echo Running shellcheck
@shellcheck --version || true @shellcheck --version || true
@shellcheck -s bash yadm test/*.bash @shellcheck -s bash yadm test/*.bash
@for bats_file in test/*bats; do \ @cd test; \
sed 's/^@test.*{/function test() {/' "$$bats_file" > "$$bats_file .bash"; \ for bats_file in *bats; do \
shellcheck -s bash "$$bats_file .bash"; \ sed 's/^@test.*{/function test() {/' "$$bats_file" > "/tmp/$$bats_file.bash"; \
shellcheck -s bash "/tmp/$$bats_file.bash"; \
test_result="$$?"; \ test_result="$$?"; \
rm -f "$$bats_file .bash"; \ rm -f "/tmp/$$bats_file.bash"; \
[ "$$test_result" -ne 0 ] && exit 1; \ [ "$$test_result" -ne 0 ] && exit 1; \
done; true done; true