diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:49:50 +0000 |
commit | 74b60c5712f2a84904b95d008953c140a9bd5dd2 (patch) | |
tree | dd12cc58c6d4cfb5e2c1183f47757295ce3b5662 /src/tests/whatis-path-to-executable | |
parent | Initial commit. (diff) | |
download | man-db-74b60c5712f2a84904b95d008953c140a9bd5dd2.tar.xz man-db-74b60c5712f2a84904b95d008953c140a9bd5dd2.zip |
Adding upstream version 2.9.4.upstream/2.9.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tests/whatis-path-to-executable')
-rwxr-xr-x | src/tests/whatis-path-to-executable | 56 |
1 files changed, 56 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..07b18a5 --- /dev/null +++ b/src/tests/whatis-path-to-executable @@ -0,0 +1,56 @@ +#! /bin/sh + +# Test that whatis behaves appropriately when given a path to an executable. + +: ${srcdir=.} +. "$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_pass 'simple name returns all matches' \ + 'diff -u "$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_pass '/usr/bin/test only returns appropriate match' \ + 'diff -u "$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_pass '/usr/local/bin/test only returns appropriate match' \ + 'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"' + +finish |