]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New test intl-2.
authorBruno Haible <bruno@clisp.org>
Sat, 20 Oct 2018 12:21:39 +0000 (14:21 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Oct 2018 18:30:38 +0000 (20:30 +0200)
* 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.

gettext-tools/tests/Makefile.am
gettext-tools/tests/intl-2 [new file with mode: 0755]
gettext-tools/tests/intl-2-1.po [new file with mode: 0644]
gettext-tools/tests/intl-2-2.po [new file with mode: 0644]

index dede082f480ef861743a41f845f692f4aaddb1e9..a96a9b5ac84c22bb76743316f8c8d9577d4515ee 100644 (file)
@@ -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 (executable)
index 0000000..f2cc7ab
--- /dev/null
@@ -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 <<EOF > in-2-1.ok
+Käse
+EOF
+cat <<EOF > 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 (file)
index 0000000..9a6231d
--- /dev/null
@@ -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 (file)
index 0000000..7f8ae59
--- /dev/null
@@ -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"