summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnish Athalye <me@anishathalye.com>2015-05-06 10:38:58 -0400
committerAnish Athalye <me@anishathalye.com>2015-05-06 10:38:58 -0400
commit53c26ba9e6ce2778c823efceb52340c40858e980 (patch)
tree7e5e7066d9a91e75a7263b08e41adf90dced557e /test
parentb0d09b70473f6acc24698f19b447f08d962216a3 (diff)
Clean up code
Diffstat (limited to 'test')
-rw-r--r--test/driver-lib.bash13
-rwxr-xr-xtest/test2
2 files changed, 9 insertions, 6 deletions
diff --git a/test/driver-lib.bash b/test/driver-lib.bash
index d43c665..f7b25ba 100644
--- a/test/driver-lib.bash
+++ b/test/driver-lib.bash
@@ -40,7 +40,6 @@ check_prereqs() {
until_success() {
local timeout=${TIMEOUT}
local attempt=0
- local success=0
while [ $attempt -lt $MAXRETRY ]; do
if ($@) >/dev/null 2>&1; then
return 0
@@ -70,8 +69,8 @@ initialize() {
tests_passed=0
tests_failed=0
tests_total="${1}"
- local plural="" && [ ${tests_total} -gt 1 ] && plural="s"
- printf -- "running %d test%s...\n\n" ${tests_total} $plural
+ local plural="" && [ "${tests_total}" -gt 1 ] && plural="s"
+ printf -- "running %d test%s...\n\n" "${tests_total}" "${plural}"
}
pass() {
@@ -88,9 +87,13 @@ fail() {
run_test() {
tests_run=$((tests_run + 1))
- printf '[%d/%d] (%s)\n' ${tests_run} ${tests_total} ${1}
+ printf '[%d/%d] (%s)\n' "${tests_run}" "${tests_total}" "${1}"
rollback || die "unable to rollback vm." # start with a clean slate
- vagrant ssh -c "cd /dotbot/test/tests && bash ${1}" 2>/dev/null && pass || fail
+ if vagrant ssh -c "cd /dotbot/test/tests && bash ${1}" 2>/dev/null; then
+ pass
+ else
+ fail
+ fi
}
report() {
diff --git a/test/test b/test/test
index 2d1e3a8..7f4b8f1 100755
--- a/test/test
+++ b/test/test
@@ -22,7 +22,7 @@ fi
initialize "${#tests[@]}"
for file in "${tests[@]}"; do
- run_test "$(basename ${file})"
+ run_test "$(basename "${file}")"
done
if report; then