]>
diplodocus.org Git - nmh/blob - test/ali/test-ali
2 ######################################################
6 ######################################################
9 # -normalize, -nonormalize
13 if test -z "${MH_OBJ_DIR}"; then
14 srcdir
=`dirname $0`/..
/..
15 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
18 .
"$MH_OBJ_DIR/test/common.sh"
22 check_exit
'-eq 1' ali
-
23 check_exit
'-eq 1' ali
-noalias -alias
24 check_exit
'-eq 1' ali
-user
25 check_exit
'-eq 1' ali
-user ''
26 check_exit
'-eq 1' ali
-user 'foo bar'
27 check_exit
'-eq 0' ali
-user foo
,bar
29 expected
=$MH_TEST_DIR/$$.expected
30 expected_err
=$MH_TEST_DIR/$$.expected_err
31 actual
=$MH_TEST_DIR/$$.actual
32 actual_err
=$MH_TEST_DIR/$$.actual_err
38 Usage: ali [switches] aliases ...
48 #### Skip nmh intro text.
49 ali
-help 2>&1 | sed '/^$/,$d' >"$actual"
50 check
"$expected" "$actual"
56 * ) echo "$0: ali -v generated unexpected output" 1>&2
57 failed
=`expr ${failed:-0} + 1`;;
60 # check unknown option
61 start_test
"unknown option"
62 run_test
'ali -nonexistent' 'ali: -nonexistent unknown'
64 # check with no arguments and no AliasFile profile component
65 start_test
"with no arguments and no AliasFile profile component"
68 # check with nonexistent alias file
69 start_test
"with nonexistent alias file"
70 run_test
'ali -alias nonexistent' \
71 "ali: aliasing error in nonexistent - unable to read 'nonexistent'"
73 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
75 rush: geddy, alex, neil
76 geddy: geddy@example.com
77 alex: alex@example.com
78 neil: neil@example.com
83 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases" \
85 rush: geddy@example.com, alex@example.com, neil@example.com
86 geddy: geddy@example.com
87 alex: alex@example.com
88 neil: neil@example.com'
90 # check for a specific alias
91 start_test
"for a specific alias"
92 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
93 'geddy@example.com, alex@example.com, neil@example.com'
95 # check for a specific alias that doesn't exist
96 start_test
"for a specific alias that doesn't exist"
97 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases nonexistent" \
102 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases -list" \
104 rush: geddy@example.com
107 geddy: geddy@example.com
108 alex: alex@example.com
109 neil: neil@example.com'
111 # check -nolist, which is the default
112 start_test
"-nolist, which is the default"
113 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases -list -nolist" \
115 rush: geddy@example.com, alex@example.com, neil@example.com
116 geddy: geddy@example.com
117 alex: alex@example.com
118 neil: neil@example.com'
122 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases -user geddy@example.com" \
128 "ali -alias ${MH_TEST_DIR}/Mail/aliases -user -nouser geddy@example.com" \
131 # check expansion of first address of blind list [Bug #15604]
132 start_test
"expansion of first address of blind list [Bug #15604]"
133 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
134 rush: Rush: geddy, alex, neil
135 geddy: geddy@example.com
136 alex: alex@example.com
137 neil: neil@example.com
140 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
141 'Rush: geddy@example.com, alex@example.com, neil@example.com'
143 # check that aliases followed by ; are not expanded [Bug #15604]
144 start_test
"that aliases followed by ; are not expanded [Bug #15604]"
145 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
146 rush: Rush: geddy, alex, neil;
147 geddy: geddy@example.com
148 alex: alex@example.com
149 neil: neil@example.com
152 run_test
"ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
153 'Rush: geddy@example.com, alex@example.com, neil;'