1#! /bin/sh
2
3# Test general operation and line wrapping.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles mm-test1.in1 mm-test1.in2"
9cat <<EOF > mm-test1.in1
10# first
11#. this should be discarded
12msgid "1"
13msgstr "1x"
14# second
15#: bogus:1
16msgid "2"
17msgstr	"this is a really long msgstr "
18	"used to test the wrapping to "
19	"make sure it works after all "
20	"what is a test for if not to test things?"
21# third
22msgid "3"
23msgstr "3z"
24EOF
25
26cat <<EOF > mm-test1.in2
27#. this is the first
28#: snark.c:345
29msgid "1"
30msgstr ""
31#. this is the second
32#: hunt.c:759
33msgid "2"
34msgstr ""
35#. this is the third
36#: boojum.c:300
37msgid "3"
38msgstr ""
39EOF
40
41tmpfiles="$tmpfiles mm-test1.out"
42: ${MSGMERGE=msgmerge}
43${MSGMERGE} -q -o mm-test1.out mm-test1.in1 mm-test1.in2
44test $? = 0 || { rm -fr $tmpfiles; exit 1; }
45
46tmpfiles="$tmpfiles mm-test1.ok"
47cat << EOF > mm-test1.ok
48# first
49#. this is the first
50#: snark.c:345
51msgid "1"
52msgstr "1x"
53
54# second
55#. this is the second
56#: hunt.c:759
57msgid "2"
58msgstr ""
59"this is a really long msgstr used to test the wrapping to make sure it works "
60"after all what is a test for if not to test things?"
61
62# third
63#. this is the third
64#: boojum.c:300
65msgid "3"
66msgstr "3z"
67EOF
68
69: ${DIFF=diff}
70${DIFF} mm-test1.ok mm-test1.out
71result=$?
72
73rm -fr $tmpfiles
74
75exit $result
76