• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test C++ support: C++11 string literals.
5
6: ${XGETTEXT=xgettext}
7
8cat <<\EOF > err0.cc
9gettext ("aaa(
10bbb
11)ccc");
12EOF
13
14(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err0.cc 2>&1; exit) | grep 'unterminated string literal' || Exit 1
15
16cat <<\EOF > err1.cc
17gettext (R"aaa(
18bbb
19)ccc");
20EOF
21
22(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.cc 2>&1; exit) | grep 'unterminated raw string literal' || Exit 1
23
24cat <<\EOF > xg-c-c++-1.cc
25#define X ""
26gettext (X"This is a concatenation of a macro and a string");
27
28#define RR ""
29gettext (RR"This (is NOT a raw string");
30
31#define u8RR ""
32gettext (u8RR"This (is NOT a raw string");
33
34#define uRR ""
35gettext (uRR"This (is NOT a raw string");
36
37#define URR ""
38gettext (URR"This (is NOT a raw string");
39
40#define LRR ""
41gettext (LRR"This (is NOT a raw string");
42
43#define uX ""
44gettext (uX"This (is NOT a raw string");
45
46gettext (u8"This is a UTF-8 string");
47
48u88"This is not a UTF-8 string";
49
50u"This is a UTF-16 string";
51
52U"This is a UTF-32 string";
53
54L"This is a wide string";
55
56gettext (R"aaa(
57This is a raw string
58)aaa");
59
60gettext (u8R"aaa(
61This is a raw UTF-8 string
62)aaa");
63
64uR"aaa(
65This is a UTF-16 raw string
66)aaa";
67
68LR"aaa(
69This is a wide raw string
70)aaa";
71
72// 'LR' prefixed raw string should be skipped.
73LR"(
74
75baz
76
77gettext(\"abc\");
78)";
79EOF
80
81${XGETTEXT} --add-comments --no-location --no-wrap \
82            -o xg-c-c++-1.tmp xg-c-c++-1.cc || Exit 1
83func_filter_POT_Creation_Date xg-c-c++-1.tmp xg-c-c++-1.po
84
85cat <<\EOF > xg-c-c++-1.ok
86# SOME DESCRIPTIVE TITLE.
87# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
88# This file is distributed under the same license as the PACKAGE package.
89# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
90#
91#, fuzzy
92msgid ""
93msgstr ""
94"Project-Id-Version: PACKAGE VERSION\n"
95"Report-Msgid-Bugs-To: \n"
96"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
97"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
98"Language-Team: LANGUAGE <LL@li.org>\n"
99"Language: \n"
100"MIME-Version: 1.0\n"
101"Content-Type: text/plain; charset=CHARSET\n"
102"Content-Transfer-Encoding: 8bit\n"
103
104msgid "This is a concatenation of a macro and a string"
105msgstr ""
106
107msgid "This (is NOT a raw string"
108msgstr ""
109
110msgid "This is a UTF-8 string"
111msgstr ""
112
113msgid ""
114"\n"
115"This is a raw string\n"
116msgstr ""
117
118msgid ""
119"\n"
120"This is a raw UTF-8 string\n"
121msgstr ""
122EOF
123
124: ${DIFF=diff}
125${DIFF} xg-c-c++-1.ok xg-c-c++-1.po || Exit 1
126
127cat <<\EOF > xg-c-c++-1.c
128gettext (R"aaa(This is NOT a raw string");
129
130gettext (u8R"aaa(This is NOT a raw string");
131
132uR"aaa(This is NOT a raw string";
133EOF
134
135${XGETTEXT} --add-comments --no-location --no-wrap \
136            -o xg-c-c++-1c.tmp xg-c-c++-1.c || Exit 1
137func_filter_POT_Creation_Date xg-c-c++-1c.tmp xg-c-c++-1c.po
138
139cat <<\EOF > xg-c-c++-1c.ok
140# SOME DESCRIPTIVE TITLE.
141# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
142# This file is distributed under the same license as the PACKAGE package.
143# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
144#
145#, fuzzy
146msgid ""
147msgstr ""
148"Project-Id-Version: PACKAGE VERSION\n"
149"Report-Msgid-Bugs-To: \n"
150"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
151"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
152"Language-Team: LANGUAGE <LL@li.org>\n"
153"Language: \n"
154"MIME-Version: 1.0\n"
155"Content-Type: text/plain; charset=CHARSET\n"
156"Content-Transfer-Encoding: 8bit\n"
157
158msgid "aaa(This is NOT a raw string"
159msgstr ""
160EOF
161
162${DIFF} xg-c-c++-1c.ok xg-c-c++-1c.po || Exit 1
163