diff options
author | Bruno Haible <bruno@clisp.org> | 2003-02-14 14:37:58 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:09:44 +0200 |
commit | a52534627a99dc5a31c9d60ca018e4459a240b50 (patch) | |
tree | a8e28df472fdcf4505ffdc26b3d7fbc3a42770c1 /gettext-tools/tests/format-ycp-2 | |
parent | 7d09134efed67c12803640588c7945eb4a10b6fe (diff) | |
download | external_gettext-a52534627a99dc5a31c9d60ca018e4459a240b50.zip external_gettext-a52534627a99dc5a31c9d60ca018e4459a240b50.tar.gz external_gettext-a52534627a99dc5a31c9d60ca018e4459a240b50.tar.bz2 |
Move tests/format-ycp-2 to gettext-tools/tests/format-ycp-2.
Diffstat (limited to 'gettext-tools/tests/format-ycp-2')
-rwxr-xr-x | gettext-tools/tests/format-ycp-2 | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/gettext-tools/tests/format-ycp-2 b/gettext-tools/tests/format-ycp-2 new file mode 100755 index 0000000..dd6159e --- /dev/null +++ b/gettext-tools/tests/format-ycp-2 @@ -0,0 +1,73 @@ +#! /bin/sh + +# Test checking of YCP format strings. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles f-y-2.data" +cat <<\EOF > f-y-2.data +# Valid: %% doesn't count +msgid "abc%%def" +msgstr "xyz" +# Invalid: invalid msgstr +msgid "abc%%def" +msgstr "xyz%" +# Valid: same arguments +msgid "abc%2def" +msgstr "xyz%2" +# Valid: permutation +msgid "abc%3%1%2def" +msgstr "xyz%2%1%3" +# Invalid: too few arguments +msgid "abc%2def%1" +msgstr "xyz%1" +# Invalid: too many arguments +msgid "abc%1def" +msgstr "xyz%1uvw%2" +# Invalid: missing non-final argument +msgid "abc%2def%1" +msgstr "xyz%2" +# Invalid: added non-final argument +msgid "abc%2def" +msgstr "xyz%1%2" +EOF + +: ${MSGFMT=msgfmt} +n=0 +while read comment; do + read msgid_line + read msgstr_line + n=`expr $n + 1` + tmpfiles="$tmpfiles f-y-2-$n.po f-y-2-$n.mo" + cat <<EOF > f-y-2-$n.po +#, ycp-format +${msgid_line} +${msgstr_line} +EOF + fail= + if echo "$comment" | grep 'Valid:' > /dev/null; then + if ${MSGFMT} --check-format -o f-y-2-$n.mo f-y-2-$n.po; then + : + else + fail=yes + fi + else + ${MSGFMT} --check-format -o f-y-2-$n.mo f-y-2-$n.po 2> /dev/null + if test $? = 1; then + : + else + fail=yes + fi + fi + if test -n "$fail"; then + echo "Format string checking error:" 1>&2 + cat f-y-2-$n.po 1>&2 + exit 1 + fi + rm -f f-y-2-$n.po f-y-2-$n.mo +done < f-y-2.data + +rm -fr $tmpfiles + +exit 0 |