-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathhelp.bats
More file actions
48 lines (40 loc) · 1.04 KB
/
help.bats
File metadata and controls
48 lines (40 loc) · 1.04 KB
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
#!/usr/bin/env bats
load test_helper
_HELP_HEADER="$(
cat <<HEREDOC
__ __
/ /_ ____ _____/ /______
/ __ \/ __ \/ ___/ __/ ___/
/ / / / /_/ (__ ) /_(__ )
/_/ /_/\____/____/\__/____/
HEREDOC
)"
export _HELP_HEADER
@test "\`help\` with no arguments exits with status 0." {
run "${_HOSTS}" help
[ "${status}" -eq 0 ]
}
@test "\`help\` with no arguments prints default help." {
run "${_HOSTS}" help
[[ $(IFS=$'\n'; echo "${lines[*]:0:5}") == "${_HELP_HEADER}" ]]
}
@test "\`hosts -h\` prints default help." {
run "${_HOSTS}" -h
[[ $(IFS=$'\n'; echo "${lines[*]:0:5}") == "${_HELP_HEADER}" ]]
}
@test "\`hosts --help\` prints default help." {
run "${_HOSTS}" --help
[[ $(IFS=$'\n'; echo "${lines[*]:0:5}") == "${_HELP_HEADER}" ]]
}
@test "\`hosts help help\` prints \`help\` subcommand usage." {
run "${_HOSTS}" help help
_expected="$(
cat <<HEREDOC
Usage:
hosts help [<command>]
Description:
Display help information for hosts or a specified command.
HEREDOC
)"
[[ "${output}" == "${_expected}" ]]
}