]> diplodocus.org Git - nmh/blobdiff - test/whatnow/test-cd
Protected use of setup_oauth_params() with #ifdef OAUTH_SUPPORT.
[nmh] / test / whatnow / test-cd
index f7f7bc991b6413e0e03d6dd569dd9a097c291bee..e5111bddefd9eb498f7b7842e4c750b9a3f414a9 100755 (executable)
@@ -17,6 +17,9 @@ fi
 
 setup_test
 
 
 setup_test
 
+# Set TERM to get consistent output.
+TERM=dumb; export TERM
+
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
 mkdir "$SPDIR"
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
 mkdir "$SPDIR"
@@ -32,24 +35,28 @@ actual=$MH_TEST_DIR/$$.actual
 #
 
 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
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
     cd) cat > "$expected" <<EOF
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
-    break;;
+    # If path to $SPDIR is too long, readline will wrap and disturb
+    # the actual output.  It obeys COLUMNS, so set that to a value
+    # that should be longer that $SPDIR plus a bit more.
+    COLUMNS=`getconf PATH_MAX . 2>/dev/null`  ||  COLUMNS=8192
+    export COLUMNS
+    ;;
     "") cat > "$expected" <<EOF
 $SPDIR
 EOF
     "") cat > "$expected" <<EOF
 $SPDIR
 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
 
 cat > $expectederr <<EOF
 esac
 
 cat > $expectederr <<EOF
@@ -57,8 +64,8 @@ EOF
 
 # ||true to ignore whatnow's exit status
 # watch the quoting -- shell and printf and then the shell run inside whatnow
 
 # ||true to ignore whatnow's exit status
 # watch the quoting -- shell and printf and then the shell run inside whatnow
-printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | \
-  TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
+printf 'cd %s/foo\\'"'"'s\\ bar\npwd\n' "$MH_TEST_DIR" | \
+  run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"