Rearranged test suite environment variables so that individual tests
[mmh] / test / whatnow / test-ls
1 #!/bin/sh
2 ######################################################
3 #
4 # Test that whatnow's "ls" copes with directory names
5 # which have spaces and quotes in them (see bug #23319)
6 #
7 ######################################################
8
9 if test -z "${MH_OBJ_DIR}"; then
10     srcdir=`dirname $0`/../..
11     MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
12 fi
13
14 . "$MH_OBJ_DIR/test/common.sh"
15
16 setup_test
17
18 set -e
19 SPDIR="$MH_TEST_DIR/foo's bar"
20 rm -rf "$SPDIR"
21 mkdir "$SPDIR"
22 cd "$SPDIR"
23 touch baz boz
24
25 expectederr=$MH_TEST_DIR/$$.expectederr
26 actualerr=$MH_TEST_DIR/$$.actualerr
27 expected=$MH_TEST_DIR/$$.expected
28 actual=$MH_TEST_DIR/$$.actual
29
30 cat > $expected <<EOF
31 baz
32 boz
33 EOF
34
35 cat > $expectederr <<EOF
36 EOF
37
38 # NB use of sort as the order of output of ls is not guaranteed
39 echo 'ls' | whatnow -noedit -prompt '' 2> "$actualerr" | sort > "$actual"
40
41 diff -u $expectederr $actualerr || exit 1
42 diff -u $expected $actual