[SCM] Git repository for devscripts branch, master, updated. v2.11.7-15-g290ccb9

Benjamin Drung bdrung at debian.org
Mon May 28 15:31:38 UTC 2012


The following commit has been merged in the master branch:
commit f464cffdcba1e057b678bb8a1e7428308bced953
Author: Benjamin Drung <bdrung at debian.org>
Date:   Mon May 28 15:24:27 2012 +0200

    test: Move runCommand to helper function file.

diff --git a/test/test_checkbashisms b/test/shunit2-helper-functions.sh
old mode 100755
new mode 100644
similarity index 80%
copy from test/test_checkbashisms
copy to test/shunit2-helper-functions.sh
index 5a9dbe1..402a7ce
--- a/test/test_checkbashisms
+++ b/test/shunit2-helper-functions.sh
@@ -1,5 +1,3 @@
-#!/bin/sh
-
 # Copyright (C) 2012, Benjamin Drung <bdrung at debian.org>
 #
 # Permission to use, copy, modify, and/or distribute this software for any
@@ -14,9 +12,6 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-COMMAND="../scripts/checkbashisms.pl"
-WORKDIR="$(readlink -f "${0%/*}")"
-
 runCommand() {
     local param="$1"
     local exp_stdout="$2"
@@ -30,16 +25,3 @@ runCommand() {
     assertEquals "error output of ${COMMAND} $param\n" "$exp_stderr" "$(cat ${stderrF})"
     assertEquals "return value of ${COMMAND} $param\n" $exp_retval $retval
 }
-
-found() {
-    cd "$WORKDIR"
-    runCommand "$1" "" "$2" 1
-}
-
-testSource() {
-    local result="possible bashism in bashisms/source line 2 (should be '.', not 'source'):
-source foo.sh"
-    found "bashisms/source" "$result"
-}
-
-. shunit2
diff --git a/test/test_checkbashisms b/test/test_checkbashisms
index 5a9dbe1..ded8a72 100755
--- a/test/test_checkbashisms
+++ b/test/test_checkbashisms
@@ -17,19 +17,7 @@
 COMMAND="../scripts/checkbashisms.pl"
 WORKDIR="$(readlink -f "${0%/*}")"
 
-runCommand() {
-    local param="$1"
-    local exp_stdout="$2"
-    local exp_stderr="$3"
-    local exp_retval=$4
-    local stdoutF="${SHUNIT_TMPDIR}/stdout"
-    local stderrF="${SHUNIT_TMPDIR}/stderr"
-    eval "${COMMAND} $param" > ${stdoutF} 2> ${stderrF}
-    retval=$?
-    assertEquals "standard output of ${COMMAND} $param\n" "$exp_stdout" "$(cat ${stdoutF})"
-    assertEquals "error output of ${COMMAND} $param\n" "$exp_stderr" "$(cat ${stderrF})"
-    assertEquals "return value of ${COMMAND} $param\n" $exp_retval $retval
-}
+. "${0%/*}/shunit2-helper-functions.sh"
 
 found() {
     cd "$WORKDIR"

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list