From: Bruno Haible Date: Sat, 20 Oct 2018 12:21:39 +0000 (+0200) Subject: New test intl-2. X-Git-Tag: v0.20~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff85bea730f79f03cdcbfd116f7e64af3a9c067a;p=thirdparty%2Fgettext.git New test intl-2. * gettext-tools/tests/intl-2: New file. * gettext-tools/tests/intl-2-1.po: New file. * gettext-tools/tests/intl-2-2.po: New file. * gettext-tools/tests/Makefile.am: Update. --- diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index dede082f4..a96a9b5ac 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -21,7 +21,7 @@ EXTRA_DIST = MOSTLYCLEANFILES = core *.stackdump TESTS = gettext-1 gettext-2 \ - intl-1 \ + intl-1 intl-2 \ intl-setlocale-1 \ gettext-4 gettext-5 gettext-6 gettext-7 gettext-8 \ msgattrib-1 msgattrib-2 msgattrib-3 msgattrib-4 msgattrib-5 \ @@ -163,7 +163,8 @@ EXTRA_DIST += init.sh init.cfg $(TESTS) \ msguniq-a.in msguniq-a.inp msguniq-a.out \ qttest_pl.po qttest_pl.qm \ qttest2_de.po qttest2_de.qm qttest2_de.ts \ - intl-1.po intl-setlocale-1-1.po intl-setlocale-1-2.po \ + intl-1.po intl-2-1.po intl-2-2.po \ + intl-setlocale-1-1.po intl-setlocale-1-2.po \ gettext-4.po gettext-5.po gettext-6-1.po gettext-6-2.po gettext-7.po \ gettextpo-1.de.po \ xgettext-1 \ diff --git a/gettext-tools/tests/intl-2 b/gettext-tools/tests/intl-2 new file mode 100755 index 000000000..f2cc7ab8f --- /dev/null +++ b/gettext-tools/tests/intl-2 @@ -0,0 +1,55 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test that gettext() returns the message converted to the locale's encoding. + +test -d in-2-1 || mkdir in-2-1 +test -d in-2-1/fr || mkdir in-2-1/fr +test -d in-2-1/fr/LC_MESSAGES || mkdir in-2-1/fr/LC_MESSAGES + +: ${MSGFMT=msgfmt} +${MSGFMT} -o in-2-1/fr/LC_MESSAGES/tstprog.mo "$abs_srcdir"/intl-2-1.po + +test -d in-2-2 || mkdir in-2-2 +test -d in-2-2/fr || mkdir in-2-2/fr +test -d in-2-2/fr/LC_MESSAGES || mkdir in-2-2/fr/LC_MESSAGES + +: ${MSGFMT=msgfmt} +${MSGFMT} -o in-2-2/fr/LC_MESSAGES/tstprog.mo "$abs_srcdir"/intl-2-2.po + +: ${DIFF=diff} +cat < in-2-1.ok +Käse +EOF +cat < in-2-2.ok +Käse +EOF + +: ${LOCALE_FR=fr_FR} +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR + prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR + ../intl-1-prg in-2-1 $LOCALE_FR > in-2.out || Exit 1 + ${DIFF} in-2-1.ok in-2.out || Exit 1 + ../intl-1-prg in-2-2 $LOCALE_FR > in-2.out || Exit 1 + ${DIFF} in-2-1.ok in-2.out || Exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR_UTF8 + prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR_UTF8 + ../intl-1-prg in-2-1 $LOCALE_FR_UTF8 > in-2.out || Exit 1 + ${DIFF} in-2-2.ok in-2.out || Exit 1 + ../intl-1-prg in-2-2 $LOCALE_FR_UTF8 > in-2.out || Exit 1 + ${DIFF} in-2-2.ok in-2.out || Exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + if test -f /usr/bin/localedef; then + echo "Skipping test: no french locale is installed" + else + echo "Skipping test: no french locale is supported" + fi + Exit 77 +fi + +Exit 0 diff --git a/gettext-tools/tests/intl-2-1.po b/gettext-tools/tests/intl-2-1.po new file mode 100644 index 000000000..9a6231d60 --- /dev/null +++ b/gettext-tools/tests/intl-2-1.po @@ -0,0 +1,8 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +msgid "cheese" +msgstr "Käse" diff --git a/gettext-tools/tests/intl-2-2.po b/gettext-tools/tests/intl-2-2.po new file mode 100644 index 000000000..7f8ae596e --- /dev/null +++ b/gettext-tools/tests/intl-2-2.po @@ -0,0 +1,8 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8-bit\n" + +msgid "cheese" +msgstr "Käse"