]> diplodocus.org Git - nmh/blobdiff - test/whatnow/test-cd
Don't consider failure to build a text/plain part to be an error.
[nmh] / test / whatnow / test-cd
index 9cc3286364b256920239a3ea74539923c031d020..e5111bddefd9eb498f7b7842e4c750b9a3f414a9 100755 (executable)
@@ -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,15 +35,19 @@ actual=$MH_TEST_DIR/$$.actual
 #
 
 set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
-
-case "${whatnowtest}" in
+case ${whatnowtest} in
     cd) cat > "$expected" <<EOF
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
+    # 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
@@ -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
-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"