Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / msgmerge-3
1 #! /bin/sh
2
3 # Test handling of obsolete/untranslated messages.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles mm-test3.in1 mm-test3.in2"
9 cat <<EOF > mm-test3.in1
10 #
11 # def.po
12 #
13 #: file:100
14 msgid ""
15 "not existing"
16 msgstr "but with translation"
17
18 #: file2:101
19 msgid "not existing without translation"
20 msgstr ""
21
22 #: file3:102
23 msgid "still existing"
24 msgstr "translation"
25
26 #: should-not-be-here:10
27 #~ msgid "former obsolete"
28 #~ msgstr ""
29 #~ "but again useful"
30
31 #~ msgid "this stays obsolete"
32 #~ msgstr "even after running msgmerge"
33
34 #
35 # trailing comments should be removed
36 EOF
37
38 cat <<EOF > mm-test3.in2
39 #
40 # ref.po
41 #
42 #: file3:102
43 msgid "still existing"
44 msgstr "here is normally no comment"
45
46 #: file4:10
47 msgid ""
48 "former obsolete"
49 msgstr ""
50
51 #
52 # trailing comments should be removed, even here
53 EOF
54
55 tmpfiles="$tmpfiles mm-test3.tmp mm-test3.out"
56 : ${MSGMERGE=msgmerge}
57 ${MSGMERGE} -q -o mm-test3.tmp mm-test3.in1 mm-test3.in2
58 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
59 LC_ALL=C tr -d '\r' < mm-test3.tmp > mm-test3.out
60 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
61
62 tmpfiles="$tmpfiles mm-test3.ok"
63 cat << EOF > mm-test3.ok
64 #: file3:102
65 msgid "still existing"
66 msgstr "translation"
67
68 #: file4:10
69 msgid "former obsolete"
70 msgstr "but again useful"
71
72 #
73 # def.po
74 #
75 #~ msgid "not existing"
76 #~ msgstr "but with translation"
77
78 #~ msgid "this stays obsolete"
79 #~ msgstr "even after running msgmerge"
80 EOF
81
82 : ${DIFF=diff}
83 ${DIFF} mm-test3.ok mm-test3.out
84 result=$?
85
86 rm -fr $tmpfiles
87
88 exit $result