Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-java-4
1 #!/bin/sh
2 #
3 # Some tests for java plural keyword support
4 #
5
6 tmpfiles=""
7 trap 'rm -fr $tmpfiles' 1 2 3 15
8
9 tmpfiles="$tmpfiles xg-j-4.java"
10 cat <<EOF > xg-j-4.java
11 class TestCase {
12     public TestCase() {
13         Bundle test = Bundle.getBundle();
14         test.ngettext(test, "test 1", "plural test");
15     }
16 }
17 EOF
18
19 tmpfiles="$tmpfiles xg-j-4.tmp.po xg-j-4.po"
20 : ${XGETTEXT=xgettext}
21 ${XGETTEXT} --omit-header --no-location --keyword=ngettext:2,3 \
22   -d xg-j-4.tmp xg-j-4.java
23 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
24 LC_ALL=C tr -d '\r' < xg-j-4.tmp.po > xg-j-4.po
25 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
26
27 tmpfiles="$tmpfiles xg-j-4.ok"
28 cat <<EOF > xg-j-4.ok
29 msgid "test 1"
30 msgid_plural "plural test"
31 msgstr[0] ""
32 msgstr[1] ""
33 EOF
34
35 : ${DIFF=diff}
36 ${DIFF} xg-j-4.ok xg-j-4.po
37 result=$?
38
39 rm -fr $tmpfiles
40
41 exit $result