archive: don't add empty directories to archives
[git] / t / t0012-help.sh
1 #!/bin/sh
2
3 test_description='help'
4
5 . ./test-lib.sh
6
7 configure_help () {
8         test_config help.format html &&
9
10         # Unless the path has "://" in it, Git tries to make sure
11         # the documentation directory locally exists. Avoid it as
12         # we are only interested in seeing an attempt to correctly
13         # invoke a help browser in this test.
14         test_config help.htmlpath test://html &&
15
16         # Name a custom browser
17         test_config browser.test.cmd ./test-browser &&
18         test_config help.browser test
19 }
20
21 test_expect_success "setup" '
22         # Just write out which page gets requested
23         write_script test-browser <<-\EOF
24         echo "$*" >test-browser.log
25         EOF
26 '
27
28 test_expect_success "works for commands and guides by default" '
29         configure_help &&
30         git help status &&
31         echo "test://html/git-status.html" >expect &&
32         test_cmp expect test-browser.log &&
33         git help revisions &&
34         echo "test://html/gitrevisions.html" >expect &&
35         test_cmp expect test-browser.log
36 '
37
38 test_expect_success "--exclude-guides does not work for guides" '
39         >test-browser.log &&
40         test_must_fail git help --exclude-guides revisions &&
41         test_must_be_empty test-browser.log
42 '
43
44 test_expect_success "--help does not work for guides" "
45         cat <<-EOF >expect &&
46                 git: 'revisions' is not a git command. See 'git --help'.
47         EOF
48         test_must_fail git revisions --help 2>actual &&
49         test_i18ncmp expect actual
50 "
51
52 test_expect_success 'generate builtin list' '
53         git --list-builtins >builtins
54 '
55
56 while read builtin
57 do
58         test_expect_success "$builtin can handle -h" '
59                 test_expect_code 129 git $builtin -h >output 2>&1 &&
60                 test_i18ngrep usage output
61         '
62 done <builtins
63
64 test_done