Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-c-19
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test C support: mixing ANSI escapes, Unicode escapes, and bare
5 # multibyte characters.
6
7 : ${XGETTEXT=xgettext}
8
9 cat <<\EOF > err1.c
10 /* Out of range */
11 gettext ("\U00110000");
12 EOF
13
14 (LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.c 2>&1; exit) | grep 'invalid Unicode character' || exit 1
15
16 cat <<\EOF > xg-c-19.in.c
17 /* 最初のコメント */
18 "最初の文字列";
19
20 /* 二番目のコメント */
21 gettext ("二番目の文字列");
22
23 /* 三番目のコメント */
24 pgettext ("\u30B3\u30F3\u30C6\u30af\u30B9\u30C8\U0001F600\ud835\udc9ea", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCe\363");
25
26 gettext ("\"\'\?\\\a\b\f\n\r\t\v\xG\0000");
27 gettext ("\u30A");
28 EOF
29
30 : ${ICONV=iconv}
31 iconv -f UTF-8 -t EUC-JP < xg-c-19.in.c > xg-c-19.c \
32   || { echo "Skipping test: iconv does not work for EUC-JP"; exit 77; }
33
34 ${XGETTEXT} --from-code=EUC-JP --add-comments --no-location --no-wrap \
35             -o - xg-c-19.c | grep -v 'POT-Creation-Date' > xg-c-19.tmp.po \
36             || exit 1
37 LC_ALL=C tr -d '\r' < xg-c-19.tmp.po > xg-c-19.po || exit 1
38
39 cat <<\EOF > xg-c-19.ok
40 # SOME DESCRIPTIVE TITLE.
41 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
42 # This file is distributed under the same license as the PACKAGE package.
43 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
44 #
45 #, fuzzy
46 msgid ""
47 msgstr ""
48 "Project-Id-Version: PACKAGE VERSION\n"
49 "Report-Msgid-Bugs-To: \n"
50 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
51 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
52 "Language-Team: LANGUAGE <LL@li.org>\n"
53 "Language: \n"
54 "MIME-Version: 1.0\n"
55 "Content-Type: text/plain; charset=UTF-8\n"
56 "Content-Transfer-Encoding: 8bit\n"
57
58 #. 二番目のコメント
59 msgid "二番目の文字列"
60 msgstr ""
61
62 #. 三番目のコメント
63 msgctxt "コンテクスト😀𝒞a"
64 msgid "三番目の文字列"
65 msgstr ""
66
67 msgid ""
68 "\"'?\\\a\b\f\n"
69 "\r\t\v\\xG"
70 msgstr ""
71
72 msgid "\\u30A"
73 msgstr ""
74 EOF
75
76 : ${DIFF=diff}
77 ${DIFF} xg-c-19.ok xg-c-19.po
78 result=$?
79
80 exit $result