diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-05-07 18:51:14 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-05-09 17:59:14 +0900 |
commit | 8e319a8bc7e535c5e2b0475d46aecdec0bf89dbe (patch) | |
tree | f8d8a69e7b7c85fa76dbab19b6e8f4e5ba69df03 /gettext-tools/tests/xgettext-c-19 | |
parent | 5839a8821d825fa6c00baddeeca9a1544f925689 (diff) | |
download | external_gettext-8e319a8bc7e535c5e2b0475d46aecdec0bf89dbe.zip external_gettext-8e319a8bc7e535c5e2b0475d46aecdec0bf89dbe.tar.gz external_gettext-8e319a8bc7e535c5e2b0475d46aecdec0bf89dbe.tar.bz2 |
c: Interpret string literals lazily
* x-c.c (P7_EOF, P7_STRING_END, P7_QUOTES, P7_QUOTE, P7_NEWLINE)
(UNICODE, IS_UNICODE, UNICODE_VALUE): Remove.
(phase7_get): Remove.
(phase7_ungetc): Remove.
(phase5_get): Use 'phase3_get' directly to extract string
literals; use 'arglist_parser_remember_literal' instead of
'arglist_parser_remember'.
(literalstring_parse): New function.
(literalstring_c): New variable.
(extract_parenthesized): Remove the
'xgettext_current_source_encoding' setting to prevent encoding
conversion around 'arglist_parser_done'.
* x-c.h (SCANNERS_C): Register 'literalstring_c' as a
literalstring_parser.
(literalstring_c): New variable declaration.
Diffstat (limited to 'gettext-tools/tests/xgettext-c-19')
-rwxr-xr-x | gettext-tools/tests/xgettext-c-19 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gettext-tools/tests/xgettext-c-19 b/gettext-tools/tests/xgettext-c-19 new file mode 100755 index 0000000..581a200 --- /dev/null +++ b/gettext-tools/tests/xgettext-c-19 @@ -0,0 +1,61 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test C support: mixing ANSI escapes, Unicode escapes, and bare +# multibyte characters. + +cat <<\EOF > xg-c-19.in.c +/* 最初のコメント */ +"最初の文字列"; + +/* 二番目のコメント */ +gettext ("二番目の文字列"); + +/* 三番目のコメント */ +pgettext ("\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8", "\xBB\xB0\xC8\xD6\xCC\xDC\xA4\xCE\xCA\xB8\xBB\xFA\xCE\xF3"); +EOF + +: ${ICONV=iconv} +iconv --from UTF-8 --to EUC-JP < xg-c-19.in.c > xg-c-19.c \ + || { echo "Skipping test: iconv does not work for EUC-JP"; exit 77; } + +: ${XGETTEXT=xgettext} +${XGETTEXT} --from-code=EUC-JP --add-comments --no-location \ + -o - xg-c-19.c | grep -v 'POT-Creation-Date' > xg-c-19.tmp.po \ + || exit 1 +LC_ALL=C tr -d '\r' < xg-c-19.tmp.po > xg-c-19.po || exit 1 + +cat <<EOF > xg-c-19.ok +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. 二番目のコメント +msgid "二番目の文字列" +msgstr "" + +#. 三番目のコメント +msgctxt "コンテクスト" +msgid "三番目の文字列" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-c-19.ok xg-c-19.po +result=$? + +exit $result |