xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/msgmerge-3 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test handling of obsolete/untranslated messages.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles mm-test3.in1 mm-test3.in2"
9cat <<EOF > mm-test3.in1
10#
11# def.po
12#
13#: file:100
14msgid ""
15"not existing"
16msgstr "but with translation"
17
18#: file2:101
19msgid "not existing without translation"
20msgstr ""
21
22#: file3:102
23msgid "still existing"
24msgstr "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
36EOF
37
38cat <<EOF > mm-test3.in2
39#
40# ref.po
41#
42#: file3:102
43msgid "still existing"
44msgstr "here is normally no comment"
45
46#: file4:10
47msgid ""
48"former obsolete"
49msgstr ""
50
51#
52# trailing comments should be removed, even here
53EOF
54
55tmpfiles="$tmpfiles mm-test3.out"
56: ${MSGMERGE=msgmerge}
57${MSGMERGE} -q -o mm-test3.out mm-test3.in1 mm-test3.in2
58test $? = 0 || { rm -fr $tmpfiles; exit 1; }
59
60tmpfiles="$tmpfiles mm-test3.ok"
61cat << EOF > mm-test3.ok
62#: file3:102
63msgid "still existing"
64msgstr "translation"
65
66#: file4:10
67msgid "former obsolete"
68msgstr "but again useful"
69
70#
71# def.po
72#
73#~ msgid "not existing"
74#~ msgstr "but with translation"
75
76#~ msgid "this stays obsolete"
77#~ msgstr "even after running msgmerge"
78EOF
79
80: ${DIFF=diff}
81${DIFF} mm-test3.ok mm-test3.out
82result=$?
83
84rm -fr $tmpfiles
85
86exit $result
87