From: David Levine Date: Tue, 7 Jan 2014 01:14:20 +0000 (-0600) Subject: Here's a better fix for the whatnow tests: set and export X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/7986520468a4956200566b728d9ea2263e28e2bc?ds=sidebyside;hp=eafc0ab02ee680ff5f9416a56f2768f564e25868 Here's a better fix for the whatnow tests: set and export TERM at the beginning of each test so that valgrind can be supported. --- diff --git a/test/whatnow/test-attach-detach b/test/whatnow/test-attach-detach index 9f308aa3..f7c39e9d 100755 --- a/test/whatnow/test-attach-detach +++ b/test/whatnow/test-attach-detach @@ -17,6 +17,9 @@ fi setup_test +# Set TERM to get consistent output. +TERM=dumb; export TERM + cd "$MH_TEST_DIR" testname="baz's boz" testname_quoted="baz\'s\ boz" @@ -38,7 +41,7 @@ touch $expected $expectederr $actual $actualerr # set +e -whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''` +whatnowtest=`echo cd | whatnow -prompt ''` set -e case ${whatnowtest} in @@ -63,13 +66,13 @@ esac # whatnow's exit status is always 1 so that is not a failure set +e echo "attach $testname_quoted" | \ - TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual -echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \ - 2>> $actualerr >> $actual + run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual +echo "alist" | \ + run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual echo "detach $testname_quoted" | \ - TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual -echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \ - 2>> $actualerr >> $actual + run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual +echo "alist" | \ + run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual set -e check "$expectederr" "$actualerr" diff --git a/test/whatnow/test-cd b/test/whatnow/test-cd index 48389cbf..8b01ab6c 100755 --- a/test/whatnow/test-cd +++ b/test/whatnow/test-cd @@ -17,6 +17,9 @@ fi setup_test +# Set TERM to get consistent output. +TERM=dumb; export TERM + SPDIR="$MH_TEST_DIR/foo's bar" rm -rf "$SPDIR" mkdir "$SPDIR" @@ -32,7 +35,7 @@ actual=$MH_TEST_DIR/$$.actual # set +e -whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''` +whatnowtest=`echo cd | whatnow -prompt ''` set -e case ${whatnowtest} in @@ -58,7 +61,7 @@ EOF # ||true to ignore whatnow's exit status # watch the quoting -- shell and printf and then the shell run inside whatnow printf 'cd %s/foo\\'"'"'s\\ bar\npwd\n' "$MH_TEST_DIR" | \ - TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true + run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true check "$expectederr" "$actualerr" check "$expected" "$actual" diff --git a/test/whatnow/test-ls b/test/whatnow/test-ls index b70f5936..6f2bebca 100755 --- a/test/whatnow/test-ls +++ b/test/whatnow/test-ls @@ -17,6 +17,9 @@ fi setup_test +# Set TERM to get consistent output. +TERM=dumb; export TERM + SPDIR="$MH_TEST_DIR/foo's bar" rm -rf "$SPDIR" mkdir "$SPDIR" @@ -33,7 +36,7 @@ actual=$MH_TEST_DIR/$$.actual # set +e -whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''` +whatnowtest=`echo cd | whatnow -prompt ''` set -e case ${whatnowtest} in @@ -58,7 +61,7 @@ cat > $expectederr < "$actualerr" | \ +echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \ sort > "$actual" check "$expectederr" "$actualerr" 'keep first' @@ -68,7 +71,7 @@ check "$expected" "$actual" 'keep first' # /bin/sh sets SHELL, which bash does. unset SHELL -echo 'ls' | TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" | \ +echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \ sort > "$actual" check "$expectederr" "$actualerr"