]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
msgfmt: Verify that .mo files are reproducible across GNU gettext versions.
authorBruno Haible <bruno@clisp.org>
Sat, 12 Jul 2025 12:38:33 +0000 (14:38 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 12 Jul 2025 12:41:08 +0000 (14:41 +0200)
* gettext-tools/tests/msgfmt-21: New file.
* gettext-tools/tests/testdata/mf-21.mo: New generated file.
* gettext-tools/tests/Makefile.am (TESTS): Add msgfmt-21.
(EXTRA_DIST): Add testdata/mf-21.mo.

gettext-tools/tests/Makefile.am
gettext-tools/tests/msgfmt-21 [new file with mode: 0644]
gettext-tools/tests/testdata/mf-21.mo [new file with mode: 0644]

index f53977aa68c5399330907610c1eaab4838ff2d0d..8b3312414f289a1b435b5c8a9b24218296063530 100644 (file)
@@ -52,7 +52,7 @@ TESTS = gettext-1 gettext-2 \
        msgfilter-sr-latin-1 msgfilter-quote-1 \
        msgfmt-1 msgfmt-2 msgfmt-3 msgfmt-4 msgfmt-5 msgfmt-6 msgfmt-7 \
        msgfmt-8 msgfmt-9 msgfmt-10 msgfmt-11 msgfmt-12 msgfmt-13 msgfmt-14 \
-       msgfmt-15 msgfmt-16 msgfmt-17 msgfmt-18 msgfmt-19 msgfmt-20 \
+       msgfmt-15 msgfmt-16 msgfmt-17 msgfmt-18 msgfmt-19 msgfmt-20 msgfmt-21 \
        msgfmt-properties-1 \
        msgfmt-tcl-1 msgfmt-tcl-2 \
        msgfmt-qt-1 msgfmt-qt-2 \
@@ -290,6 +290,7 @@ EXTRA_DIST += init.sh init.cfg $(TESTS) \
        testdata/dprog.utf-8.d testdata/dprog.utf-8+bom.d \
        testdata/dprog.utf-16be.d testdata/dprog.utf-16le.d \
        testdata/dprog.utf-32be.d testdata/dprog.utf-32le.d \
+       testdata/mf-21.mo \
        testdata/nonascii.pot \
        testdata/repo.tar.gz \
        testdata/tcltest_pl.po testdata/tcltest_pl.msg \
diff --git a/gettext-tools/tests/msgfmt-21 b/gettext-tools/tests/msgfmt-21
new file mode 100644 (file)
index 0000000..9d75fef
--- /dev/null
@@ -0,0 +1,21 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test that MO files are reproducible across GNU gettext versions
+# (because the unit tests of some packages, such as the Translate Toolkit,
+# compare .mo files against expected results).
+
+test -d mf-21 || mkdir mf-21
+test -d mf-21/LC_MESSAGES || mkdir mf-21/LC_MESSAGES
+
+cat <<\EOF > mf-21.po
+msgid "Hello, world!"
+msgstr "Hallo Welt!"
+EOF
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} --endianness=little -o mf-21.mo mf-21.po || Exit 1
+
+cmp "$wabs_srcdir"/testdata/mf-21.mo mf-21.mo || Exit 1
+
+exit 0
diff --git a/gettext-tools/tests/testdata/mf-21.mo b/gettext-tools/tests/testdata/mf-21.mo
new file mode 100644 (file)
index 0000000..d114fcc
Binary files /dev/null and b/gettext-tools/tests/testdata/mf-21.mo differ