]> diplodocus.org Git - nmh/blobdiff - test/whatnow/test-ls
netsec_set_tls(): Return a value in the !TLS_SUPPORT && !tls case.
[nmh] / test / whatnow / test-ls
index c289830c8506d312a6241dfa5c34ebcabb209756..6f2bebca107226194b56ffa9fec50319ff1d564a 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"
@@ -28,16 +31,48 @@ actualerr=$MH_TEST_DIR/$$.actualerr
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
-cat > $expected <<EOF
+#
+# Handle different output depending on readline version
+#
+
+set +e
+whatnowtest=`echo cd | whatnow -prompt ''`
+set -e
+
+case ${whatnowtest} in
+    cd) cat > "$expected" <<EOF
 baz
 boz
 baz
 boz
+ls
 EOF
 EOF
+    ;;
+    "") cat > "$expected" <<EOF
+baz
+boz
+EOF
+    ;;
+    *) echo "Unknown response to whatnow readline test"
+    echo "Response is: ${whatnowtest}"
+    exit 1
+    ;;
+esac
 
 cat > $expectederr <<EOF
 EOF
 
 # NB use of sort as the order of output of ls is not guaranteed
 
 cat > $expectederr <<EOF
 EOF
 
 # NB use of sort as the order of output of ls is not guaranteed
-echo 'ls' | whatnow -noedit -prompt '' 2> "$actualerr" | sort > "$actual"
+echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
+       sort > "$actual"
+
+check "$expectederr" "$actualerr" 'keep first'
+check "$expected" "$actual" 'keep first'
+
+# Check with SHELL unset.  This won't reveal any problems if
+# /bin/sh sets SHELL, which bash does.
+unset SHELL
+
+echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
+       sort > "$actual"
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"