]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tests: Check invalid memory access in Lisp/Scheme
authorDaiki Ueno <ueno@gnu.org>
Fri, 12 Dec 2014 08:20:23 +0000 (17:20 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 12 Dec 2014 08:20:23 +0000 (17:20 +0900)
* format-lisp-2, format-scheme-2: Test type compatibility with
non-strict checking mode.

gettext-tools/tests/ChangeLog
gettext-tools/tests/format-lisp-2
gettext-tools/tests/format-scheme-2

index b4811e56d82f72494089a49b891c74dc6ca870af..12bc804986482659082330f34937d91a6c45d1b8 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-12  Daiki Ueno  <ueno@gnu.org>
+
+       * format-lisp-2, format-scheme-2: Test type compatibility with
+       non-strict checking mode.
+
 2014-12-09  Daiki Ueno  <ueno@gnu.org>
 
        * gettext-8-prg.c: Include <assert.h>.
index 4698932e1fc83389483fe6f5cb03e5c677d417df..46c4feea1c64b3da9e5dd76e76d9e6df6d252833 100755 (executable)
@@ -163,6 +163,11 @@ msgstr "xyz~<~D~;~D~C~S~;~S~>"
 # Invalid: justification catches ~^
 msgid  "abc~<~D~;~^~D~>~C"
 msgstr "abc~D~^~D~C"
+# Invalid: type compatibility with non-strict checking
+msgid "abc~{~c~c~}"
+msgid_plural "abc~{~c~c~}"
+msgstr[0] "xyz~{~c~d~}"
+msgstr[1] "xyz~{~c~d~}"
 EOF
 
 : ${MSGFMT=msgfmt}
@@ -170,12 +175,28 @@ n=0
 while read comment; do
   read msgid_line
   read msgstr_line
+  msgid_plural_line=""
+  if echo "$msgstr_line" | grep '^msgid_plural' > /dev/null; then
+    msgid_plural_line="$msgstr_line"
+    read msgstr0_line
+    read msgstr1_line
+  fi
   n=`expr $n + 1`
-  cat <<EOF > f-l-2-$n.po
+  if test -z "$msgid_plural_line"; then
+    cat <<EOF > f-l-2-$n.po
 #, lisp-format
 ${msgid_line}
 ${msgstr_line}
 EOF
+  else
+    cat <<EOF > f-l-2-$n.po
+#, lisp-format
+${msgid_line}
+${msgid_plural_line}
+${msgstr0_line}
+${msgstr1_line}
+EOF
+  fi
   fail=
   if echo "$comment" | grep 'Valid:' > /dev/null; then
     if ${MSGFMT} --check-format -o f-l-2-$n.mo f-l-2-$n.po; then
index 8be3daa69b2d8c9aa6f09f2f6755c28739a836f7..44829aea34997acffa7da8481aec0a5cf8d9a6c4 100755 (executable)
@@ -178,6 +178,11 @@ msgstr "xyz~{~1@*~C~2:*~D~^~1*~}"
 # Invalid: ~^ inside iteration depends on position
 msgid  "abc~{~D ~^~C~}"
 msgstr "xyz~{~1@*~C~2:*~D~1*~^~}"
+# Invalid: type compatibility with non-strict checking
+msgid "abc~{~c~c~}"
+msgid_plural "abc~{~c~c~}"
+msgstr[0] "xyz~{~c~d~}"
+msgstr[1] "xyz~{~c~d~}"
 EOF
 
 : ${MSGFMT=msgfmt}
@@ -185,12 +190,28 @@ n=0
 while read comment; do
   read msgid_line
   read msgstr_line
+  msgid_plural_line=""
+  if echo "$msgstr_line" | grep '^msgid_plural' > /dev/null; then
+    msgid_plural_line="$msgstr_line"
+    read msgstr0_line
+    read msgstr1_line
+  fi
   n=`expr $n + 1`
-  cat <<EOF > f-sc-2-$n.po
+  if test -z "$msgid_plural_line"; then
+    cat <<EOF > f-sc-2-$n.po
 #, scheme-format
 ${msgid_line}
 ${msgstr_line}
 EOF
+  else
+    cat <<EOF > f-l-2-$n.po
+#, lisp-format
+${msgid_line}
+${msgid_plural_line}
+${msgstr0_line}
+${msgstr1_line}
+EOF
+  fi
   fail=
   if echo "$comment" | grep 'Valid:' > /dev/null; then
     if ${MSGFMT} --check-format -o f-sc-2-$n.mo f-sc-2-$n.po; then