summaryrefslogtreecommitdiffstats
path: root/src/tests/man-recode-suffix
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/man-recode-suffix
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/man-recode-suffix')
-rwxr-xr-xsrc/tests/man-recode-suffix46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tests/man-recode-suffix b/src/tests/man-recode-suffix
new file mode 100755
index 0000000..7c0a32c
--- /dev/null
+++ b/src/tests/man-recode-suffix
@@ -0,0 +1,46 @@
+#! /bin/sh
+
+# Test man-recode's --suffix behaviour.
+
+: "${srcdir=.}"
+# shellcheck source-path=SCRIPTDIR
+. "$srcdir/testlib.sh"
+
+: "${MAN_RECODE=man-recode}"
+
+init
+
+cat >"$tmpdir/a.1.exp" <<'EOF'
+.SH NAME
+a \- á
+EOF
+cp "$tmpdir/a.1.exp" "$tmpdir/a.1"
+cat >"$tmpdir/b.1.exp" <<'EOF'
+'\" -*- coding: UTF-8 -*-
+.SH NAME
+b \- é
+EOF
+gzip -c <"$tmpdir/b.1.exp" >"$tmpdir/b.1.gz"
+cat >"$tmpdir/c.1.exp" <<'EOF'
+'\" -*- coding: UTF-8
+.SH NAME
+b \- é
+EOF
+cat >"$tmpdir/c.1" <<'EOF'
+'\" -*- coding: ISO-8859-1
+EOF
+<"$tmpdir/c.1.exp" tail -n +2 | iconv -f UTF-8 -t ISO-8859-1 >>"$tmpdir/c.1"
+gzip "$tmpdir/c.1"
+
+run $MAN_RECODE -t UTF-8 --suffix .out \
+ "$tmpdir/a.1" "$tmpdir/b.1.gz" "$tmpdir/c.1.gz"
+expect_files_equal '--suffix with no coding tag' \
+ "$tmpdir/a.1.exp" "$tmpdir/a.1.out"
+expect_files_equal \
+ '--suffix with gzip and coding tag matching target encoding' \
+ "$tmpdir/b.1.exp" "$tmpdir/b.1.out"
+expect_files_equal \
+ '--suffix with gzip and coding tag not matching target encoding' \
+ "$tmpdir/c.1.exp" "$tmpdir/c.1.out"
+
+finish