summaryrefslogtreecommitdiffstats
path: root/src/tests/zsoelim-so-includes
blob: 9a43c1a12901824e016d462318f07aeff4c66f95 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/sh

# Test for:
#   https://bugs.debian.org/503472

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

: "${MAN=man}"

init
fake_config /usr/local/man /usr/share/man
MANPATH="$tmpdir/usr/local/man:$tmpdir/usr/share/man"
export MANPATH

cat >"$tmpdir/fake-program" <<EOF
#! /bin/sh
exec cat
EOF
chmod +x "$tmpdir/fake-program"
PATH="$abstmpdir:$PATH"
export PATH

cat >>"$tmpdir/manpath.config" <<EOF
DEFINE tbl fake-program
DEFINE nroff fake-program
EOF

write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
	UTF-8 '' '' 'test \- top-level test page'
echo '.so man7/test2.7' >>"$tmpdir/usr/share/man/man1/test.1"
write_page test2 7 "$tmpdir/usr/local/man/man7/test2.7" \
	UTF-8 '' '' 'test2 \- second-level local test page'
echo '.so test3.1' >>"$tmpdir/usr/local/man/man7/test2.7"
write_page test3 1 "$tmpdir/usr/local/man/man1/test3.1" \
	UTF-8 '' '' 'test3 \- third-level local test page'
write_page test3 1 "$tmpdir/usr/share/man/man1/test3.1" \
	UTF-8 '' '' 'test3 \- third-level test page'
cat >"$tmpdir/1.exp" <<'EOF'
.TH test 1
.SH NAME
test \- top-level test page
.SH DESCRIPTION
test
.TH test2 7
.SH NAME
test2 \- second-level local test page
.SH DESCRIPTION
test
.TH test3 1
.SH NAME
test3 \- third-level test page
.SH DESCRIPTION
test
EOF
run $MAN -C "$tmpdir/manpath.config" test | \
	grep -v '^\.l[flt] ' >"$tmpdir/1.out"
expect_files_equal 'test(1) expanded correctly' "$tmpdir/1.exp" "$tmpdir/1.out"

finish