summaryrefslogtreecommitdiffstats
path: root/src/tests/mandb-symlink-beats-whatis-ref
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/tests/mandb-symlink-beats-whatis-ref61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tests/mandb-symlink-beats-whatis-ref b/src/tests/mandb-symlink-beats-whatis-ref
new file mode 100755
index 0000000..f177ddb
--- /dev/null
+++ b/src/tests/mandb-symlink-beats-whatis-ref
@@ -0,0 +1,61 @@
+#! /bin/sh
+
+# Test for:
+# https://bugs.debian.org/204249
+
+: "${srcdir=.}"
+# shellcheck source-path=SCRIPTDIR
+. "$srcdir/testlib.sh"
+
+: "${MANDB=mandb}"
+: "${ACCESSDB=accessdb}"
+
+init
+fake_config /usr/share/man /usr/X11R6/man
+MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
+export MANPATH
+db_ext="$(db_ext)"
+
+write_page xterm 1x "$tmpdir/usr/X11R6/man/man1/xterm.1x.gz" \
+ UTF-8 gz '' 'xterm \- terminal emulator for X'
+mkdir -p "$tmpdir/usr/share/man/man1"
+ln -s ../../../X11R6/man/man1/xterm.1x.gz \
+ "$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
+run $MANDB -C "$tmpdir/manpath.config" -u -q \
+ "$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
+cat >"$tmpdir/1-share.exp" <<EOF
+x-terminal-emulator -> "- 1 1 MTIME B - - gz terminal emulator for X"
+EOF
+cat >"$tmpdir/1-X11R6.exp" <<EOF
+xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
+EOF
+accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1-share.out"
+accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/1-X11R6.out"
+expect_files_equal '/usr/share/man x-terminal-emulator -> xterm' \
+ "$tmpdir/1-share.exp" "$tmpdir/1-share.out"
+expect_files_equal '/usr/X11R6/man x-terminal-emulator -> xterm' \
+ "$tmpdir/1-X11R6.exp" "$tmpdir/1-X11R6.out"
+
+./fspause
+write_page uxterm 1x "$tmpdir/usr/X11R6/man/man1/uxterm.1x.gz" \
+ UTF-8 gz '' \
+ 'uxterm \- X terminal emulator for Unicode (UTF-8) environments'
+ln -sf ../../../X11R6/man/man1/uxterm.1x.gz \
+ "$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
+run $MANDB -C "$tmpdir/manpath.config" -u -q \
+ "$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
+cat >"$tmpdir/2-share.exp" <<EOF
+x-terminal-emulator -> "- 1 1 MTIME B - - gz X terminal emulator for Unicode (UTF-8) environments"
+EOF
+cat >"$tmpdir/2-X11R6.exp" <<EOF
+uxterm -> "- 1x 1 MTIME A - - gz X terminal emulator for Unicode (UTF-8) environments"
+xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
+EOF
+accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2-share.out"
+accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/2-X11R6.out"
+expect_files_equal '/usr/share/man x-terminal-emulator -> uxterm' \
+ "$tmpdir/2-share.exp" "$tmpdir/2-share.out"
+expect_files_equal '/usr/X11R6/man x-terminal-emulator -> uxterm' \
+ "$tmpdir/2-X11R6.exp" "$tmpdir/2-X11R6.out"
+
+finish