summaryrefslogtreecommitdiffstats
path: root/src/tests/manconv-guess-from-encoding
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:19:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:19:27 +0000
commite0023883c6d2e6745a19e4b48e186ed156c1fca8 (patch)
tree1a48b8056ec984385d0d862b683535d04d6ed215 /src/tests/manconv-guess-from-encoding
parentInitial commit. (diff)
downloadman-db-e0023883c6d2e6745a19e4b48e186ed156c1fca8.tar.xz
man-db-e0023883c6d2e6745a19e4b48e186ed156c1fca8.zip
Adding upstream version 2.11.2.upstream/2.11.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tests/manconv-guess-from-encoding')
-rwxr-xr-xsrc/tests/manconv-guess-from-encoding39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tests/manconv-guess-from-encoding b/src/tests/manconv-guess-from-encoding
new file mode 100755
index 0000000..2fd5a98
--- /dev/null
+++ b/src/tests/manconv-guess-from-encoding
@@ -0,0 +1,39 @@
+#! /bin/sh
+
+# Test manconv's support for guessing the input encoding if it is not
+# explicitly specified.
+
+: "${srcdir=.}"
+# shellcheck source-path=SCRIPTDIR
+. "$srcdir/testlib.sh"
+
+: "${MANCONV=manconv}"
+
+init
+
+write_page coding-tag 7 \
+ "$tmpdir/usr/share/man/man7/coding-tag.7" \
+ ISO-8859-1 '' '' 'coding-tag \- é'
+iconv -f ISO-8859-1 -t UTF-8 \
+ <"$tmpdir/usr/share/man/man7/coding-tag.7" \
+ >"$tmpdir/coding-tag.7.exp"
+run $MANCONV -t UTF-8 "$tmpdir/usr/share/man/man7/coding-tag.7" \
+ >"$tmpdir/coding-tag.7.out"
+expect_files_equal 'recode from encoding guessed from directory name' \
+ "$tmpdir/coding-tag.7.exp" "$tmpdir/coding-tag.7.out"
+
+write_page lang-dir 7 \
+ "$tmpdir/usr/share/man/fr_FR.ISO-8859-1/man7/lang-dir.7.gz" \
+ ISO-8859-1 gz '-*- coding: ISO-8859-1 -*-' 'lang-dir \- é'
+cat >"$tmpdir/lang-dir.7.exp" <<'EOF'
+'\" -*- coding: UTF-8 -*-
+EOF
+zcat "$tmpdir/usr/share/man/fr_FR.ISO-8859-1/man7/lang-dir.7.gz" | \
+ tail -n +2 | iconv -f ISO-8859-1 -t UTF-8 >>"$tmpdir/lang-dir.7.exp"
+run $MANCONV -t UTF-8 \
+ "$tmpdir/usr/share/man/fr_FR.ISO-8859-1/man7/lang-dir.7.gz" \
+ >"$tmpdir/lang-dir.7.out"
+expect_files_equal 'recode from encoding guessed from directory name' \
+ "$tmpdir/lang-dir.7.exp" "$tmpdir/lang-dir.7.out"
+
+finish