setup_test
+# Set TERM to get consistent output.
+TERM=dumb; export TERM
+
SPDIR="$MH_TEST_DIR/foo's bar"
rm -rf "$SPDIR"
mkdir "$SPDIR"
#
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
- break;;
+ ;;
"") cat > "$expected" <<EOF
$SPDIR
EOF
- break;;
+ ;;
*) echo "Unknown response to whatnow readline test"
echo "Response is: ${whatnowtest}"
exit 1
- break;;
+ ;;
esac
cat > $expectederr <<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"