On 01/11/13 07:06, Jason St. John wrote:
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> ---
<snip>
diff --git a/lib/libalpm/version.c b/lib/libalpm/version.c index f25b279..f7e17db 100644 --- a/lib/libalpm/version.c +++ b/lib/libalpm/version.c
All the comments here are directly from RPM. Do not adjust them.
@@ -153,7 +153,7 @@ static int rpmvercmp(const char *a, const char *b)
if(isnum) { /* this used to be done by converting the digit segments */ - /* to ints using atoi() - it's changed because long */ + /* to ints using atoi() - it's changed because long */ /* digit segments can overflow an int - this should fix that. */
/* throw away any leading zeros - it's a number, right? */ @@ -172,7 +172,7 @@ static int rpmvercmp(const char *a, const char *b) }
/* strcmp will return which one is greater - even if the two */ - /* segments are alpha or if they are numeric. don't return */ + /* segments are alpha or if they are numeric. don't return */ /* if they are equal because there might be more segments to */ /* compare */ rc = strcmp(one, two);
<snip> I don't think the following two files need fixed given it is the complete file that will be changed. I'll let Dave make the call on this.
diff --git a/test/scripts/human_to_size_test.sh b/test/scripts/human_to_size_test.sh index 6306137..659d78c 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
diff --git a/test/scripts/parseopts_test.sh b/test/scripts/parseopts_test.sh index 5ff4bc5..4a21351 100755 --- a/test/scripts/parseopts_test.sh +++ b/test/scripts/parseopts_test.sh @@ -5,14 +5,14 @@ declare -i testcount=0 pass=0 fail=0 total=25 # source the library function lib=${1:-${PMTEST_SCRIPTLIB_DIR}parseopts.sh} if [[ -z $lib || ! -f $lib ]]; then - printf "Bail out! parseopts library ($lib) could not be located\n" - exit 1 + printf "Bail out! parseopts library ($lib) could not be located\n" + exit 1 fi . "$lib"
if ! type -t parseopts >/dev/null; then - printf 'Bail out! parseopts function not found\n' - exit 1 + printf 'Bail out! parseopts function not found\n' + exit 1 fi
# borrow opts from makepkg @@ -24,38 +24,38 @@ OPT_LONG=('allsource' 'asroot' 'ignorearch' 'check' 'clean:' 'cleanall' 'nodeps' 'noconfirm' 'noprogressbar')
parse() { - local result=$1 tokencount=$2; shift 2 + local result=$1 tokencount=$2; shift 2
- (( ++testcount )) - parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null - test_result "$result" "$tokencount" "$*" "${OPTRET[@]}" - unset OPTRET + (( ++testcount )) + parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@" 2>/dev/null + test_result "$result" "$tokencount" "$*" "${OPTRET[@]}" + unset OPTRET }
test_result() { - local result=$1 tokencount=$2 input=$3; shift 3 - - if [[ $result = "$*" ]] && (( tokencount == $# )); then - (( ++pass )) - printf 'ok %d - %s\n' "$testcount" "$input" - else - printf 'not ok %d - %s\n' "$testcount" "$input" - printf '# [TEST %3s]: FAIL\n' "$testcount" - printf '# input: %s\n' "$input" - printf '# output: %s (%s tokens)\n' "$*" "$#" - printf '# expected: %s (%s tokens)\n' "$result" "$tokencount" - (( ++fail )) - fi + local result=$1 tokencount=$2 input=$3; shift 3 + + if [[ $result = "$*" ]] && (( tokencount == $# )); then + (( ++pass )) + printf 'ok %d - %s\n' "$testcount" "$input" + else + printf 'not ok %d - %s\n' "$testcount" "$input" + printf '# [TEST %3s]: FAIL\n' "$testcount" + printf '# input: %s\n' "$input" + printf '# output: %s (%s tokens)\n' "$*" "$#" + printf '# expected: %s (%s tokens)\n' "$result" "$tokencount" + (( ++fail )) + 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