summaryrefslogtreecommitdiffstats
path: root/gettext-tools
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-12-09 07:09:45 +0900
committerDaiki Ueno <ueno@gnu.org>2014-12-09 07:09:55 +0900
commit1461b7168d4b9ceeb42e086b80bc8a417ca75843 (patch)
treedb3d99cce5551a4b4cbd86fdf87c4e7a9f9136c2 /gettext-tools
parentdee40f0602625f62443c4d715a1b9674742c9a3e (diff)
downloadexternal_gettext-1461b7168d4b9ceeb42e086b80bc8a417ca75843.zip
external_gettext-1461b7168d4b9ceeb42e086b80bc8a417ca75843.tar.gz
external_gettext-1461b7168d4b9ceeb42e086b80bc8a417ca75843.tar.bz2
tests: Improve test coverage of Desktop scanner
* xgettext-desktop-1: Test invalid input and blank lines.
Diffstat (limited to 'gettext-tools')
-rw-r--r--gettext-tools/tests/ChangeLog5
-rwxr-xr-xgettext-tools/tests/xgettext-desktop-137
2 files changed, 38 insertions, 4 deletions
diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog
index b4fa4d0..00c088d 100644
--- a/gettext-tools/tests/ChangeLog
+++ b/gettext-tools/tests/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-09 Daiki Ueno <ueno@gnu.org>
+
+ tests: Improve test coverage of Desktop scanner
+ * xgettext-desktop-1: Test invalid input and blank lines.
+
2014-12-07 Daiki Ueno <ueno@gnu.org>
tests: Improve test coverage of Vala scanner
diff --git a/gettext-tools/tests/xgettext-desktop-1 b/gettext-tools/tests/xgettext-desktop-1
index 0839ee5..ae90879 100755
--- a/gettext-tools/tests/xgettext-desktop-1
+++ b/gettext-tools/tests/xgettext-desktop-1
@@ -3,16 +3,43 @@
# Test of Desktop Entry support.
-cat <<EOF > xg.desktop
+: ${XGETTEXT=xgettext}
+
+cat <<\EOF >err1.desktop
+[Desktop Entry]
+This is an invalid line
+Name =Foo
+EOF
+
+(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err1.desktop 2>&1; exit) | grep "missing '=' after" || exit 1
+
+cat <<\EOF >err2.desktop
+[Desktop Entry
+EOF
+
+(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err2.desktop 2>&1; exit) | grep "unterminated group name" || exit 1
+
+cat <<\EOF >err3.desktop
+[Desktop Entry]
+ Not a blank line!
+EOF
+
+(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err3.desktop 2>&1; exit) | grep "invalid non-blank line" || exit 1
+
+cat <<\EOF > xg.desktop
[Desktop Entry]
Type=Application
Name =Foo
+# This is a comment for comment
+# This is a comment for comment
Comment= \sThis is a \nmultiline\t comment; for testing
Comment[foo]=Already translated comment
+X-Foo = bar
+# This is a comment before a blank line
+
Keywords=Keyword1;Keyword2;Key\;word3;
EOF
-: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments -o - xg.desktop | grep -v 'POT-Creation-Date' > xg-desktop.pot || exit 1
cat <<\EOF > xg-desktop.ok
@@ -38,13 +65,15 @@ msgstr ""
msgid "Foo"
msgstr ""
-#: xg.desktop:5
+#. This is a comment for comment
+#. This is a comment for comment
+#: xg.desktop:7
msgid ""
" This is a \n"
"multiline\t comment; for testing"
msgstr ""
-#: xg.desktop:7
+#: xg.desktop:12
msgid "Keyword1;Keyword2;Key\\;word3;"
msgstr ""
EOF