]> diplodocus.org Git - nmh/blobdiff - test/whatnow/test-attach-detach
Here's a better fix for the whatnow tests: set and export
[nmh] / test / whatnow / test-attach-detach
index fe5785cda34ab8c5f32a3b0aa3d9a7e67ad841ac..f7c39e9d6dd40216c994be2655130db88b44973f 100755 (executable)
@@ -17,6 +17,9 @@ fi
 
 setup_test
 
 
 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"
 cd "$MH_TEST_DIR"
 testname="baz's boz"
 testname_quoted="baz\'s\ boz"
@@ -38,10 +41,10 @@ touch $expected $expectederr $actual $actualerr
 #
 
 set +e
 #
 
 set +e
-whatnowtest="$(echo cd | TERM=dumb whatnow -prompt '')"
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 
 set -e
 
-case "${whatnowtest}" in
+case ${whatnowtest} in
     cd) cat > "$expected" <<EOF
 attach $testname_quoted
 alist
     cd) cat > "$expected" <<EOF
 attach $testname_quoted
 alist
@@ -49,27 +52,27 @@ $testname
 detach $testname_quoted
 alist
 EOF
 detach $testname_quoted
 alist
 EOF
-    break;;
+    ;;
     "") cat > "$expected" <<EOF
 $testname
 EOF
     "") cat > "$expected" <<EOF
 $testname
 EOF
-    break;;
+    ;;
     *) echo "Unknown response to whatnow readline test"
     echo "Response is: ${whatnowtest}"
     exit 1
     *) echo "Unknown response to whatnow readline test"
     echo "Response is: ${whatnowtest}"
     exit 1
-    break;;
+    ;;
 esac
 
 # whatnow's exit status is always 1 so that is not a failure
 set +e
 echo "attach $testname_quoted" | \
 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" | \
 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"
 set -e
 
 check "$expectederr" "$actualerr"