summaryrefslogtreecommitdiffstats
path: root/src/tests/manpath-slash
blob: 181bd92b2bff0dbe47e1d50ea8011814a66fec4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/sh

: "${srcdir=.}"
# shellcheck source-path=SCRIPTDIR
. "$srcdir/testlib.sh"

: "${MANPATH=manpath}"

# Check whether manpath correctly parses PATH elements with trailing slash.

init
fake_config /usr/share/man
mkdir -p "$tmpdir/bin"
mkdir -p "$tmpdir/share/man"
OLDPATH="$PATH"
export PATH="$tmpdir/bin/:$OLDPATH"
output=$(run $MANPATH)
case "$output" in
	"$tmpdir/share/man:"*) report "manpath with trailing slash" 0 ;;
	*) report "manpath with trailing slash" 1 ;;
esac
export PATH="$tmpdir/bin:$OLDPATH"
output=$(run $MANPATH)
case "$output" in
	"$tmpdir/share/man:"*) report "manpath without trailing slash" 0 ;;
	*) report "manpath without trailing slash" 1 ;;
esac
finish