From: Bruno Haible Date: Sun, 26 Jun 2022 07:05:16 +0000 (+0200) Subject: xgettext: Add test for last fix. X-Git-Tag: v0.21.1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c557d42952223012bb05a7837b0c937673843e5c;p=thirdparty%2Fgettext.git xgettext: Add test for last fix. Reported by Jonathan Matthew in . * gettext-tools/tests/xgettext-18: New file. * gettext-tools/tests/Makefile.am (TESTS): Add it. --- diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 5e1377594..9a7ae03de 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -1,5 +1,5 @@ ## Makefile for the gettext-tools/tests subdirectory of GNU gettext -## Copyright (C) 1995-1997, 2001-2010, 2012-2016, 2018-2020 Free Software Foundation, Inc. +## Copyright (C) 1995-1997, 2001-2010, 2012-2016, 2018-2022 Free Software Foundation, Inc. ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -78,6 +78,7 @@ TESTS = gettext-1 gettext-2 \ xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \ xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 xgettext-12 \ xgettext-13 xgettext-14 xgettext-15 xgettext-16 \ + xgettext-18 \ xgettext-appdata-1 \ xgettext-awk-1 xgettext-awk-2 \ xgettext-c-2 xgettext-c-3 xgettext-c-4 xgettext-c-5 xgettext-c-6 \ diff --git a/gettext-tools/tests/xgettext-18 b/gettext-tools/tests/xgettext-18 new file mode 100755 index 000000000..fc225622f --- /dev/null +++ b/gettext-tools/tests/xgettext-18 @@ -0,0 +1,41 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test format string recognition when different programming languages are used. + +cat <<\EOF > xg-18-a.py +print(gettext.gettext("Found %(count)d warnings") % { 'count': 7 }) +EOF + +cat <<\EOF > xg-18-b.ui + + + +
+ + Use in % of disk + +
+
+
+EOF + +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location -d xg-18.tmp xg-18-a.py xg-18-b.ui \ + || Exit 1 +LC_ALL=C tr -d '\r' < xg-18.tmp.po > xg-18.po || Exit 1 + +cat < xg-18.ok +#, python-format +msgid "Found %(count)d warnings" +msgstr "" + +msgid "Use in % of disk" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-18.ok xg-18.po +result=$? + +exit $result