diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:19:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:19:27 +0000 |
commit | e0023883c6d2e6745a19e4b48e186ed156c1fca8 (patch) | |
tree | 1a48b8056ec984385d0d862b683535d04d6ed215 /src/tests/whatis-path-to-executable | |
parent | Initial commit. (diff) | |
download | man-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 '')
-rwxr-xr-x | src/tests/whatis-path-to-executable | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tests/whatis-path-to-executable b/src/tests/whatis-path-to-executable new file mode 100755 index 0000000..d358aad --- /dev/null +++ b/src/tests/whatis-path-to-executable @@ -0,0 +1,57 @@ +#! /bin/sh + +# Test that whatis behaves appropriately when given a path to an executable. + +: "${srcdir=.}" +# shellcheck source-path=SCRIPTDIR +. "$srcdir/testlib.sh" + +: "${MANDB=mandb}" +: "${WHATIS=whatis}" + +init +fake_config /usr/share/man /usr/local/man +cat >>"$tmpdir/manpath.config" <<EOF +MANPATH_MAP $tmpdir/usr/bin $tmpdir/usr/share/man +MANPATH_MAP $tmpdir/usr/local/bin $tmpdir/usr/local/man +EOF +MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/local/man" +export MANPATH + +write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" \ + UTF-8 gz '' 'test \- /usr/bin/test' +write_page test 8 "$tmpdir/usr/local/man/man8/test.8.gz" \ + UTF-8 gz '' 'test \- /usr/local/bin/test' +mkdir -p "$tmpdir/usr/bin" "$tmpdir/usr/local/bin" +touch "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test" +chmod +x "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test" +run $MANDB -C "$tmpdir/manpath.config" -u -q \ + "$tmpdir/usr/share/man:$tmpdir/usr/local/man" + +cat >"$tmpdir/1.exp" <<EOF +test (1) - /usr/bin/test +test (8) - /usr/local/bin/test +EOF +PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \ + -C "$tmpdir/manpath.config" test >"$tmpdir/1.out" +expect_files_equal 'simple name returns all matches' \ + "$tmpdir/1.exp" "$tmpdir/1.out" + +cat >"$tmpdir/2.exp" <<EOF +test (1) - /usr/bin/test +EOF +PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \ + -C "$tmpdir/manpath.config" "$tmpdir/usr/bin/test" >"$tmpdir/2.out" +expect_files_equal '/usr/bin/test only returns appropriate match' \ + "$tmpdir/2.exp" "$tmpdir/2.out" + +cat >"$tmpdir/3.exp" <<EOF +test (8) - /usr/local/bin/test +EOF +PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \ + -C "$tmpdir/manpath.config" "$tmpdir/usr/local/bin/test" \ + >"$tmpdir/3.out" +expect_files_equal '/usr/local/bin/test only returns appropriate match' \ + "$tmpdir/3.exp" "$tmpdir/3.out" + +finish |