• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/tests/
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.tmp.po xg-po-1.po"
49: ${XGETTEXT=xgettext}
50${XGETTEXT} --omit-header -n \
51  -d xg-po-1.tmp xg-po-1.in.po xg-po-1.c xg-po-1.cc
52test $? = 0 || { rm -fr $tmpfiles; exit 1; }
53tr -d '\r' < xg-po-1.tmp.po > xg-po-1.po
54test $? = 0 || { rm -fr $tmpfiles; exit 1; }
55
56tmpfiles="$tmpfiles xg-po-1.ok"
57cat <<EOF > xg-po-1.ok
58#: file1.c:199
59#, fuzzy
60msgid "extract me"
61msgstr "some text to get fuzzy copied to result"
62
63#: file2.cc:200
64msgid "what about me"
65msgstr ""
66
67#: file3.c:10
68#, fuzzy, c-format
69msgid "hello"
70msgstr "Again some text for fuzzy"
71
72#: xg-po-1.c:6
73#, c-format
74msgid "Hello, world."
75msgstr ""
76
77#: xg-po-1.cc:7
78msgid "Hello world!"
79msgstr ""
80EOF
81
82: ${DIFF=diff}
83${DIFF} xg-po-1.ok xg-po-1.po
84result=$?
85
86rm -fr $tmpfiles
87
88exit $result
89