Added m_getfld () interface description.
[mmh] / test / repl / test-if-str
1 #!/bin/sh
2 ######################################################
3 #
4 # Test that an '%<(function)...' if-construct correctly
5 # tests whether 'str' is empty if the function returns
6 # a string, and tests 'value' if the function returns
7 # an integer.
8 #
9 ######################################################
10
11 if test -z "${MH_OBJ_DIR}"; then
12     srcdir=`dirname "$0"`/../..
13     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
14 fi
15
16 . "$MH_OBJ_DIR/test/common.sh"
17
18 setup_test
19
20 # create test replgroupcomps
21 form=$MH_TEST_DIR/$$.replgroupcomps
22 cat > $form <<EOF
23 X-STRING: %(num)%(lit)%<(lit FOO) found%| missing%>\n\
24 X-NUMBER: %(num)%(lit)%<(num 3) yes%| no%>\n\
25 X-NOSTRING: %(num 3)%(lit x)%<(lit) found%| missing%>\n\
26 X-NONUMBER: %(num 3)%(lit x)%<(num) yes%| no%>\n\
27 --------
28 EOF
29
30 expected=$MH_TEST_DIR/$$.expected
31 actual=$MH_TEST_DIR/Mail/draft
32
33 cat > $expected <<EOF
34 X-STRING: 0 found
35 X-NUMBER: 0 yes
36 X-NOSTRING: 3x missing
37 X-NONUMBER: 3x no
38 --------
39 Test1 writes:
40 > This is message number 1
41 EOF
42
43 repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1 || exit 1
44
45 check "$expected" "$actual"
46
47 test ${failed:-0} -eq 0  &&  rm "$form"
48
49 exit $failed