]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tests: Improve test coverage of Desktop scanner
authorDaiki Ueno <ueno@gnu.org>
Mon, 8 Dec 2014 22:09:45 +0000 (07:09 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 8 Dec 2014 22:09:55 +0000 (07:09 +0900)
* xgettext-desktop-1: Test invalid input and blank lines.

gettext-tools/tests/ChangeLog
gettext-tools/tests/xgettext-desktop-1

index b4fa4d053db7dc82da9e97b8c41874f84891cbcf..00c088ddeec2f966e9ebeda53d009b7edced66fa 100644 (file)
@@ -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
index 0839ee5d0ac421dc3b95627c172a9c05065032ae..ae908795cc2aac2fcf044b8e44393fccb2e9987a 100755 (executable)
@@ -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