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