string.c: Improve documentation of create_argv().
[paraslash.git] / t / t0005-man.sh
1 #!/usr/bin/env bash
2
3 test_description='Parse generated man pages.
4
5 Simple sanity checks of some man pages.
6
7 * para_audiod: Check that list of audiod commands is present
8 * para_server: Check that list of server/afs commands is present
9 * para_play: Check that list of play commands is present
10
11 * para_{recv,filter,write,audiod}: Check for presence of
12 filter/receiver/writer options as appropriate '
13
14 . ${0%/*}/test-lib.sh
15
16 rfw_regex='Options for .\{100,\}Options for ' # recv/filter/writer
17
18 grep_man()
19 {
20         local regex="$1" exe="$2"
21         tr '\n' ' ' < "$o_man_dir/para_$exe.1" | grep -q "$regex"
22 }
23
24 # check that options of all reveivers/filters/writers are contained
25 # in the man pages
26
27 regex="$rfw_regex"
28 test_expect_success 'para_recv: receiver options' "grep_man '$regex' recv"
29 test_expect_success 'para_filter: filter options' "grep_man '$regex' filter"
30 test_expect_success 'para_write: writer options' "grep_man '$regex' write"
31 test_require_objects "audiod"
32 if [[ -n "$result" ]]; then
33         test_skip 'para_audiod' "missing object(s): $result"
34 else
35         test_expect_success 'para_audiod: receivers' \
36                 "grep_man 'Options for the http receiver' audiod"
37         test_expect_success 'para_audiod: filters' \
38                 "grep_man 'Options for the compress filter' audiod"
39         test_expect_success 'para_audiod: writers' \
40                 "grep_man 'Options for the file writer' audiod"
41 fi
42
43 # check various command lists
44
45 test_require_objects "audiod"
46 if [[ -n "$result" ]]; then
47         test_skip 'para_audiod' "missing object(s): $result"
48 else
49         regex='LIST OF AUDIOD COMMANDS.\{200,\}'
50         test_expect_success 'para_audiod: command list' \
51                 "grep_man '$regex' audiod"
52 fi
53
54 test_require_objects "server"
55 missing_objects="$result"
56 if [[ -n "$missing_objects" ]]; then
57         test_skip "para_server" "missing object(s): $missing_objects"
58 else
59         regex='LIST OF SERVER COMMANDS.\{100,\}LIST OF AFS COMMANDS'
60         test_expect_success 'para_server: server/afs commands' \
61                 "grep_man '$regex' server"
62 fi
63
64 # para_play is always built
65 regex='LIST OF COMMANDS.\{100,\}'
66 test_expect_success 'para_play: play commands' "grep_man '$regex' play"
67 test_done