blob: 5051d50be651ec5d75e0f0e2c3bc34fdf3e543d5 (
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
62
63
64
65
|
#! /bin/sh
# Test additional language-specific requests for localized man pages.
: "${srcdir=.}"
# shellcheck source-path=SCRIPTDIR
. "$srcdir/testlib.sh"
: "${MAN=man}"
init
fake_config /usr/share/man
MANPATH="$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'
write_page test 1 "$tmpdir/usr/share/man/xyzzy/man1/test.1" \
UTF-8 '' '' 'test \- xyzzy language page for test'
write_page xyz 1 "$tmpdir/usr/share/man/man1/xyz.1" \
UTF-8 '' '' 'test \- top-level xyz page'
: >"$tmpdir/1.exp"
# shellcheck disable=SC2154
if [ "$troff_is_groff" = yes ]; then
cat >>"$tmpdir/1.exp" <<'EOF'
. mso xyzzy.tmac
.hla xyzzy
EOF
fi
cat >>"$tmpdir/1.exp" <<'EOF'
test \- xyzzy language page for test
EOF
cat >"$tmpdir/2.exp" <<'EOF'
.TH xyz 1
test \- top-level xyz page
EOF
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" test |\
grep 'xyzzy' >"$tmpdir/1.out"
expect_files_equal 'language-specific requests for localized man page' \
"$tmpdir/1.exp" "$tmpdir/1.out"
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" xyz |\
grep 'xyz' >"$tmpdir/2.out"
expect_files_equal 'no language-specific requests for top-level man page' \
"$tmpdir/2.exp" "$tmpdir/2.out"
finish
|