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