Re-work the test suite so it now works with Automake (via "make check").
[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 [ -z "${MH_TEST_COMMON}" ]; then
12     echo "MH_TEST_COMMON not set; try running via 'make check'"
13 fi
14
15 . ${MH_TEST_COMMON}
16
17 setup_test
18
19 # create test replgroupcomps
20 form=$MH_TEST_DIR/$$.replgroupcomps
21 cat > $form <<EOF
22 X-STRING: %(num)%(lit)%<(lit FOO) found%| missing%>\n\
23 X-NUMBER: %(num)%(lit)%<(num 3) yes%| no%>\n\
24 X-NOSTRING: %(num 3)%(lit x)%<(lit) found%| missing%>\n\
25 X-NONUMBER: %(num 3)%(lit x)%<(num) yes%| no%>\n\
26 --------
27 EOF
28
29 expected=$MH_TEST_DIR/$$.expected
30 actual=$MH_TEST_DIR/Mail/draft
31
32 cat > $expected <<EOF
33 X-STRING: 0 found
34 X-NUMBER: 0 yes
35 X-NOSTRING: 3x missing
36 X-NONUMBER: 3x no
37 --------
38 Test1 writes:
39 > This is message number 1
40 EOF
41
42 repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1 || exit 1
43
44 diff -u $expected $actual