]>
diplodocus.org Git - nmh/blob - test/whatnow/test-ls
2 ######################################################
4 # Test that whatnow's "ls" copes with directory names
5 # which have spaces and quotes in them (see bug #23319)
7 ######################################################
11 if test -z "${MH_OBJ_DIR}"; then
12 srcdir
=`dirname "$0"`/..
/..
13 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
16 .
"$MH_OBJ_DIR/test/common.sh"
20 # Set TERM to get consistent output.
21 TERM
=dumb
; export TERM
23 SPDIR
="$MH_TEST_DIR/foo's bar"
29 expectederr
=$MH_TEST_DIR/$$.expectederr
30 actualerr
=$MH_TEST_DIR/$$.actualerr
31 expected
=$MH_TEST_DIR/$$.expected
32 actual
=$MH_TEST_DIR/$$.actual
35 # Handle different output depending on readline version
39 whatnowtest
=`echo cd | whatnow -prompt ''`
42 case ${whatnowtest} in
43 cd) cat > "$expected" <<EOF
49 "") cat > "$expected" <<EOF
54 *) echo "Unknown response to whatnow readline test"
55 echo "Response is: ${whatnowtest}"
60 cat > $expectederr <<EOF
63 # NB use of sort as the order of output of ls is not guaranteed
64 echo 'ls' | run_prog whatnow
-noedit -prompt '' 2> "$actualerr" | \
67 check
"$expectederr" "$actualerr" 'keep first'
68 check
"$expected" "$actual" 'keep first'
70 # Check with SHELL unset. This won't reveal any problems if
71 # /bin/sh sets SHELL, which bash does.
74 echo 'ls' | run_prog whatnow
-noedit -prompt '' 2> "$actualerr" | \
77 check
"$expectederr" "$actualerr"
78 check
"$expected" "$actual"
80 # On some platforms, need to be out of $SPDIR in order to remove it.
82 test ${failed:-0} -eq 0 && rm -r "$SPDIR"