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