• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
9cat <<\EOF > err1.c
10/* Out of range */
11gettext ("\U00110000");
12EOF
13
14(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location --no-wrap -o - err1.c 2>&1; exit) | grep 'invalid Unicode character' || Exit 1
15
16cat <<\EOF > xg-c-escape-1.in.c
17/* 最初のコメント */
18"最初の文字列";
19
20/* 二番目のコメント */
21gettext ("二番目の文字列");
22
23/* 三番目のコメント */
24pgettext ("\u30B3\u30F3\u30C6\u30af\u30B9\u30C8\U0001F600\ud835\udc9ea", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCe\363");
25
26gettext ("\"\'\?\\\a\b\f\n\r\t\v\xG\0000");
27gettext ("\u30A");
28EOF
29
30: ${ICONV=iconv}
31iconv -f UTF-8 -t EUC-JP < xg-c-escape-1.in.c > xg-c-escape-1.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-escape-1.tmp xg-c-escape-1.c || Exit 1
36func_filter_POT_Creation_Date xg-c-escape-1.tmp xg-c-escape-1.po
37
38cat <<\EOF > xg-c-escape-1.ok
39# SOME DESCRIPTIVE TITLE.
40# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
41# This file is distributed under the same license as the PACKAGE package.
42# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
43#
44#, fuzzy
45msgid ""
46msgstr ""
47"Project-Id-Version: PACKAGE VERSION\n"
48"Report-Msgid-Bugs-To: \n"
49"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
50"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
51"Language-Team: LANGUAGE <LL@li.org>\n"
52"Language: \n"
53"MIME-Version: 1.0\n"
54"Content-Type: text/plain; charset=UTF-8\n"
55"Content-Transfer-Encoding: 8bit\n"
56
57#. 二番目のコメント
58msgid "二番目の文字列"
59msgstr ""
60
61#. 三番目のコメント
62msgctxt "コンテクスト����a"
63msgid "三番目の文字列"
64msgstr ""
65
66msgid ""
67"\"'?\\\a\b\f\n"
68"\r\t\v\\xG"
69msgstr ""
70
71msgid "\\u30A"
72msgstr ""
73EOF
74
75: ${DIFF=diff}
76${DIFF} xg-c-escape-1.ok xg-c-escape-1.po
77result=$?
78
79exit $result
80