depricate whatnow
[mmh] / test / tests / whatnow / test-cd
1 #!/bin/sh
2 ######################################################
3 #
4 # Test that whatnow's "cd" copes with directory names
5 # which have spaces and quotes in them (see bug #23319)
6 #
7 ######################################################
8
9 set -e
10 SPDIR="$MH_TEST_DIR/foo's bar"
11 rm -rf "$SPDIR"
12 mkdir "$SPDIR"
13 cd "$SPDIR"
14 touch baz boz
15 cd
16
17 expectederr=$MH_TEST_DIR/$$.expectederr
18 actualerr=$MH_TEST_DIR/$$.actualerr
19 expected=$MH_TEST_DIR/$$.expected
20 actual=$MH_TEST_DIR/$$.actual
21
22 cat > $expected <<EOF
23 $SPDIR
24 EOF
25
26 cat > $expectederr <<EOF
27 whatnow: whatnow is deprecated. Consider switching to whatnow2.
28 EOF
29
30 # create a draft message
31 comp -whatnow true
32
33 # ||true to ignore whatnow's exit status
34 # watch the quoting -- shell and printf and then the shell run inside whatnow
35 printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | whatnow -prompt '' 2> "$actualerr" > "$actual" || true
36
37 diff -u $expectederr $actualerr
38 diff -u $expected $actual