File: test-if-str

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (50 lines) | stat: -rwxr-xr-x 1,174 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
######################################################
#
# Test that an '%<(function)...' if-construct correctly
# tests whether 'str' is empty if the function returns
# a string, and tests 'value' if the function returns
# an integer.
#
######################################################

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname "$0"`/../..
    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi

. "$MH_OBJ_DIR/test/common.sh"

setup_test

# create test replgroupcomps
form=$MH_TEST_DIR/$$.replgroupcomps
cat > $form <<EOF
X-STRING: %(num)%(lit)%<(lit FOO) found%| missing%>\n\
X-NUMBER: %(num)%(lit)%<(num 3) yes%| no%>\n\
X-NOSTRING: %(num 3)%(lit x)%<(lit) found%| missing%>\n\
X-NONUMBER: %(num 3)%(lit x)%<(num) yes%| no%>\n\
--------
EOF

expected=$MH_TEST_DIR/$$.expected
actual=$MH_TEST_DIR/Mail/draft

cat > $expected <<EOF
X-STRING: 0 found
X-NUMBER: 0 yes
X-NOSTRING: 3x missing
X-NONUMBER: 3x no
--------
Test1 writes:
> This is message number 1
EOF

run_prog repl -editor true -format -form $form -group -nocc me \
  -nowhatnowproc 1 || exit 1

check "$expected" "$actual"

test ${failed:-0} -eq 0  &&  rm "$form"

exit $failed