Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-properties-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C, C++, JavaProperties extractors.
5
6 cat <<EOF > xg-pr-1.in.properties
7 #: file1.c:199
8 #, fuzzy
9 !extract\ me=some text to get fuzzy copied to result
10
11 #: file2.cc:200
12 !what\ about\ me=
13
14 #: file3.c:10
15 #, c-format, fuzzy
16 !hello=Again some text for fuzzy
17 EOF
18
19 cat <<EOF > xg-pr-1.c
20 #include <libintl.h>
21 #include <stdio.h>
22 int
23 main (int argc, char *argv[])
24 {
25   printf (dcgettext ("hello", "Hello, world."));
26   return 0;
27 }
28 EOF
29
30 cat <<EOF > xg-pr-1.cc
31 #include <iostream.h>
32 #include <libintl.h>
33 #include <locale.h>
34 int
35 main (int argc, char *argv[])
36 {
37   cout << dcgettext ("hello", "Hello world!", LC_MESSAGES) << endl;
38   return 0;
39 }
40 EOF
41
42 : ${XGETTEXT=xgettext}
43 ${XGETTEXT} --omit-header -n \
44   -d xg-pr-1.tmp xg-pr-1.in.properties xg-pr-1.c xg-pr-1.cc || exit 1
45 LC_ALL=C tr -d '\r' < xg-pr-1.tmp.po > xg-pr-1.po || exit 1
46
47 cat <<EOF > xg-pr-1.ok
48 #: file1.c:199
49 #, fuzzy
50 msgid "extract me"
51 msgstr "some text to get fuzzy copied to result"
52
53 #: file2.cc:200
54 msgid "what about me"
55 msgstr ""
56
57 #: file3.c:10
58 #, fuzzy, c-format
59 msgid "hello"
60 msgstr "Again some text for fuzzy"
61
62 #: xg-pr-1.c:6
63 #, c-format
64 msgid "Hello, world."
65 msgstr ""
66
67 #: xg-pr-1.cc:7
68 msgid "Hello world!"
69 msgstr ""
70 EOF
71
72 : ${DIFF=diff}
73 ${DIFF} xg-pr-1.ok xg-pr-1.po
74 result=$?
75
76 exit $result