groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 07/10: Test localization refactor.


From: G. Branden Robinson
Subject: [groff] 07/10: Test localization refactor.
Date: Thu, 15 Apr 2021 06:24:52 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 2a047db626b1cf683d440fefe048341a1fef62e5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Apr 13 15:35:51 2021 +1000

    Test localization refactor.
    
    * src/roff/groff/tests/localization_works.sh: Add 10 test cases.
    * src/roff/groff/groff.am (groff_TESTS): Run test.
---
 src/roff/groff/groff.am                    |  1 +
 src/roff/groff/tests/localization_works.sh | 92 ++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)

diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 42fb983..faf8406 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -45,6 +45,7 @@ groff_TESTS = \
   src/roff/groff/tests/do_not_loop_infinitely_when_breaking_cjk.sh \
   src/roff/groff/tests/dot-cp_register_works.sh \
   src/roff/groff/tests/dot-nm_register_works.sh \
+  src/roff/groff/tests/localization_works.sh \
   src/roff/groff/tests/msoquiet_works.sh \
   src/roff/groff/tests/on_latin1_device_oq_is_0x27.sh \
   src/roff/groff/tests/recognize_end_of_sentence.sh \
diff --git a/src/roff/groff/tests/localization_works.sh 
b/src/roff/groff/tests/localization_works.sh
new file mode 100755
index 0000000..3418c34
--- /dev/null
+++ b/src/roff/groff/tests/localization_works.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+#
+# Copyright (C) 2021 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+set -e
+
+export LC_ALL LANG
+
+DOC='\*[locale]'
+
+# Test fallback/conflicting cases.
+
+echo "testing that LC_ALL= LANG= loads English localization" >&2
+LC_ALL=
+LANG=
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx english
+
+echo "testing that LC_ALL=en_US loads English localization" >&2
+LC_ALL=en_US
+LANG=
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx english
+
+echo "testing that LC_ALL=en_US LANG=fr_FR loads English localization" \
+  >&2
+LC_ALL=en_US
+LANG=fr_FR
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx english
+
+# Test straightforward cases.
+
+echo "testing that LC_ALL= LANG=cs_CZ loads Czech localization" >&2
+LC_ALL=
+LANG=cs_CZ
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx czech
+
+echo "testing that LC_ALL= LANG=de_DE loads German localization" >&2
+LC_ALL=
+LANG=de_DE
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx german
+
+echo "testing that LC_ALL= LANG=en_US loads English localization" >&2
+LC_ALL=
+LANG=en_US
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx english
+
+echo "testing that LC_ALL= LANG=fr_FR loads French localization" >&2
+LC_ALL=
+LANG=fr_FR
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx french
+
+echo "testing that LC_ALL= LANG=ja_JP loads Japanese localization" >&2
+LC_ALL=
+LANG=ja_JP
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx japanese
+
+echo "testing that LC_ALL= LANG=sv_SE loads Swedish localization" >&2
+LC_ALL=
+LANG=sv_SE
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx swedish
+
+echo "testing that LC_ALL= LANG=zh_ZH loads Chinese localization" >&2
+LC_ALL=
+LANG=zh_ZH
+OUTPUT=$(echo "$DOC" | "$groff" -Tascii)
+echo "$OUTPUT" | grep -qx chinese



reply via email to

[Prev in Thread] Current Thread [Next in Thread]