fsck: remove the unused MISSING_TREE_OBJECT
[git.git] / t / t0041-usage.sh
blobc4fc34eb18eb1401c5331667408c496e663c9c69
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-lib.sh
10 test_expect_success 'setup ' '
11 test_commit "v1.0"
14 test_expect_success 'tag --contains <existent_tag>' '
15 git tag --contains "v1.0" >actual 2>actual.err &&
16 grep "v1.0" actual &&
17 test_line_count = 0 actual.err
20 test_expect_success 'tag --contains <inexistent_tag>' '
21 test_must_fail git tag --contains "notag" >actual 2>actual.err &&
22 test_line_count = 0 actual &&
23 test_i18ngrep "error" actual.err &&
24 test_i18ngrep ! "usage" actual.err
27 test_expect_success 'tag --no-contains <existent_tag>' '
28 git tag --no-contains "v1.0" >actual 2>actual.err &&
29 test_line_count = 0 actual &&
30 test_line_count = 0 actual.err
33 test_expect_success 'tag --no-contains <inexistent_tag>' '
34 test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
35 test_line_count = 0 actual &&
36 test_i18ngrep "error" actual.err &&
37 test_i18ngrep ! "usage" actual.err
40 test_expect_success 'tag usage error' '
41 test_must_fail git tag --noopt >actual 2>actual.err &&
42 test_line_count = 0 actual &&
43 test_i18ngrep "usage" actual.err
46 test_expect_success 'branch --contains <existent_commit>' '
47 git branch --contains "main" >actual 2>actual.err &&
48 test_i18ngrep "main" actual &&
49 test_line_count = 0 actual.err
52 test_expect_success 'branch --contains <inexistent_commit>' '
53 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
54 test_line_count = 0 actual &&
55 test_i18ngrep "error" actual.err &&
56 test_i18ngrep ! "usage" actual.err
59 test_expect_success 'branch --no-contains <existent_commit>' '
60 git branch --no-contains "main" >actual 2>actual.err &&
61 test_line_count = 0 actual &&
62 test_line_count = 0 actual.err
65 test_expect_success 'branch --no-contains <inexistent_commit>' '
66 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
67 test_line_count = 0 actual &&
68 test_i18ngrep "error" actual.err &&
69 test_i18ngrep ! "usage" actual.err
72 test_expect_success 'branch usage error' '
73 test_must_fail git branch --noopt >actual 2>actual.err &&
74 test_line_count = 0 actual &&
75 test_i18ngrep "usage" actual.err
78 test_expect_success 'for-each-ref --contains <existent_object>' '
79 git for-each-ref --contains "main" >actual 2>actual.err &&
80 test_line_count = 2 actual &&
81 test_line_count = 0 actual.err
84 test_expect_success 'for-each-ref --contains <inexistent_object>' '
85 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
86 test_line_count = 0 actual &&
87 test_i18ngrep "error" actual.err &&
88 test_i18ngrep ! "usage" actual.err
91 test_expect_success 'for-each-ref --no-contains <existent_object>' '
92 git for-each-ref --no-contains "main" >actual 2>actual.err &&
93 test_line_count = 0 actual &&
94 test_line_count = 0 actual.err
97 test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
98 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
99 test_line_count = 0 actual &&
100 test_i18ngrep "error" actual.err &&
101 test_i18ngrep ! "usage" actual.err
104 test_expect_success 'for-each-ref usage error' '
105 test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
106 test_line_count = 0 actual &&
107 test_i18ngrep "usage" actual.err
110 test_done