Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/test/scripts/human_to_size_test.sh
diff options
context:
space:
mode:
authorJason St. John <jstjohn@purdue.edu>2013-11-08 00:44:40 -0500
committerAllan McRae <allan@archlinux.org>2013-11-15 11:02:27 +1000
commit230bd5c2fd11f6256e1ab16c2e5997a8d8228461 (patch)
treeab33d063641bb3f8f3998caa3aea4db92d8989b7 /test/scripts/human_to_size_test.sh
parentb7b3f9c5e7903272bef32792ab28615f434d3ec8 (diff)
Fix whitespace and other formatting issues
This commit: -- replaces space-based indents with tabs per the coding standards -- removes extraneous whitespace (e.g. extra spaces between function args) -- adds missing braces for a one-line if statement Signed-off-by: Jason St. John <jstjohn@purdue.edu>
Diffstat (limited to 'test/scripts/human_to_size_test.sh')
-rwxr-xr-xtest/scripts/human_to_size_test.sh54
1 files changed, 27 insertions, 27 deletions
diff --git a/test/scripts/human_to_size_test.sh b/test/scripts/human_to_size_test.sh
index a467f27e..cde3ba82 100755
--- a/test/scripts/human_to_size_test.sh
+++ b/test/scripts/human_to_size_test.sh
@@ -5,43 +5,43 @@ declare -i testcount=0 fail=0 pass=0 total=15
# source the library function
lib=${1:-${PMTEST_SCRIPTLIB_DIR}human_to_size.sh}
if [[ -z $lib || ! -f $lib ]]; then
- echo "Bail out! human_to_size library ($lib) could not be located\n"
- exit 1
+ echo "Bail out! human_to_size library ($lib) could not be located\n"
+ exit 1
fi
. "$lib"
if ! type -t human_to_size &>/dev/null; then
- printf 'Bail out! human_to_size function not found\n'
- exit 1
+ printf "Bail out! human_to_size function not found\n"
+ exit 1
fi
parse_hts() {
- local input=$1 expected=$2 result
-
- (( ++testcount ))
-
- result=$(human_to_size "$1")
- if [[ $result = "$expected" ]]; then
- (( ++pass ))
- printf "ok %d - %s\n" "$testcount" "$input"
- else
- (( ++fail ))
- printf "not ok %d - %s\n" "$testcount" "$input"
- printf '# [TEST %3s]: FAIL\n' "$testcount"
- printf '# input: %s\n' "$input"
- printf '# output: %s\n' "$result"
- printf '# expected: %s\n' "$expected"
- fi
+ local input=$1 expected=$2 result
+
+ (( ++testcount ))
+
+ result=$(human_to_size "$1")
+ if [[ $result = "$expected" ]]; then
+ (( ++pass ))
+ printf "ok %d - %s\n" "$testcount" "$input"
+ else
+ (( ++fail ))
+ printf "not ok %d - %s\n" "$testcount" "$input"
+ printf '# [TEST %3s]: FAIL\n' "$testcount"
+ printf '# input: %s\n' "$input"
+ printf '# output: %s\n' "$result"
+ printf '# expected: %s\n' "$expected"
+ fi
}
summarize() {
- if (( !fail )); then
- printf '# All %s tests successful\n\n' "$testcount"
- exit 0
- else
- printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
- exit 1
- fi
+ if (( !fail )); then
+ printf '# All %s tests successful\n\n' "$testcount"
+ exit 0
+ else
+ printf '# %s of %s tests failed\n\n' "$fail" "$testcount"
+ exit 1
+ fi
}
trap 'summarize' EXIT