]> diplodocus.org Git - nmh/blobdiff - test/whatnow/test-cd
Fix substitution code so it uses the right pointer for the utf-8 test.
[nmh] / test / whatnow / test-cd
index bfa6f4ee4d560e88713ff181e74e1389d69601fe..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,15 +35,19 @@ actual=$MH_TEST_DIR/$$.actual
 #
 
 set +e
 #
 
 set +e
-whatnowtest=`echo cd | TERM=dumb run_prog whatnow -prompt ''`
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 set -e
-
 case ${whatnowtest} in
     cd) cat > "$expected" <<EOF
 cd ${MH_TEST_DIR}/foo\'s\ bar
 pwd
 $SPDIR
 EOF
 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
     ;;
     "") cat > "$expected" <<EOF
 $SPDIR
@@ -58,8 +65,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" | \
 # ||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 run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || \
-  true
+  run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"