t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t0041-usage.sh
blob1464294bd1bfc36d48f06a3ead7826daeb9a745c
1 #!/bin/sh
3 test_description='Test commands behavior when given invalid argument value'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 test_expect_success 'setup ' '
12 test_commit "v1.0"
15 test_expect_success 'tag --contains <existent_tag>' '
16 git tag --contains "v1.0" >actual 2>actual.err &&
17 grep "v1.0" actual &&
18 test_line_count = 0 actual.err
21 test_expect_success 'tag --contains <inexistent_tag>' '
22 test_must_fail git tag --contains "notag" >actual 2>actual.err &&
23 test_line_count = 0 actual &&
24 test_grep "error" actual.err &&
25 test_grep ! "usage" actual.err
28 test_expect_success 'tag --no-contains <existent_tag>' '
29 git tag --no-contains "v1.0" >actual 2>actual.err &&
30 test_line_count = 0 actual &&
31 test_line_count = 0 actual.err
34 test_expect_success 'tag --no-contains <inexistent_tag>' '
35 test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
36 test_line_count = 0 actual &&
37 test_grep "error" actual.err &&
38 test_grep ! "usage" actual.err
41 test_expect_success 'tag usage error' '
42 test_must_fail git tag --noopt >actual 2>actual.err &&
43 test_line_count = 0 actual &&
44 test_grep "usage" actual.err
47 test_expect_success 'branch --contains <existent_commit>' '
48 git branch --contains "main" >actual 2>actual.err &&
49 test_grep "main" actual &&
50 test_line_count = 0 actual.err
53 test_expect_success 'branch --contains <inexistent_commit>' '
54 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
55 test_line_count = 0 actual &&
56 test_grep "error" actual.err &&
57 test_grep ! "usage" actual.err
60 test_expect_success 'branch --no-contains <existent_commit>' '
61 git branch --no-contains "main" >actual 2>actual.err &&
62 test_line_count = 0 actual &&
63 test_line_count = 0 actual.err
66 test_expect_success 'branch --no-contains <inexistent_commit>' '
67 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
68 test_line_count = 0 actual &&
69 test_grep "error" actual.err &&
70 test_grep ! "usage" actual.err
73 test_expect_success 'branch usage error' '
74 test_must_fail git branch --noopt >actual 2>actual.err &&
75 test_line_count = 0 actual &&
76 test_grep "usage" actual.err
79 test_expect_success 'for-each-ref --contains <existent_object>' '
80 git for-each-ref --contains "main" >actual 2>actual.err &&
81 test_line_count = 2 actual &&
82 test_line_count = 0 actual.err
85 test_expect_success 'for-each-ref --contains <inexistent_object>' '
86 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
87 test_line_count = 0 actual &&
88 test_grep "error" actual.err &&
89 test_grep ! "usage" actual.err
92 test_expect_success 'for-each-ref --no-contains <existent_object>' '
93 git for-each-ref --no-contains "main" >actual 2>actual.err &&
94 test_line_count = 0 actual &&
95 test_line_count = 0 actual.err
98 test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
99 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
100 test_line_count = 0 actual &&
101 test_grep "error" actual.err &&
102 test_grep ! "usage" actual.err
105 test_expect_success 'for-each-ref usage error' '
106 test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
107 test_line_count = 0 actual &&
108 test_grep "usage" actual.err
111 test_done