Merge branch 'kg/gc-auto-windows-workaround'
[alt-git.git] / t / t0041-usage.sh
blob5b927b76fe58e5284d7b74e2f9fd8cc0b1f07764
1 #!/bin/sh
3 test_description='Test commands behavior when given invalid argument value'
5 . ./test-lib.sh
7 test_expect_success 'setup ' '
8 test_commit "v1.0"
11 test_expect_success 'tag --contains <existent_tag>' '
12 git tag --contains "v1.0" >actual 2>actual.err &&
13 grep "v1.0" actual &&
14 test_line_count = 0 actual.err
17 test_expect_success 'tag --contains <inexistent_tag>' '
18 test_must_fail git tag --contains "notag" >actual 2>actual.err &&
19 test_line_count = 0 actual &&
20 test_i18ngrep "error" actual.err &&
21 test_i18ngrep ! "usage" actual.err
24 test_expect_success 'tag --no-contains <existent_tag>' '
25 git tag --no-contains "v1.0" >actual 2>actual.err &&
26 test_line_count = 0 actual &&
27 test_line_count = 0 actual.err
30 test_expect_success 'tag --no-contains <inexistent_tag>' '
31 test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
32 test_line_count = 0 actual &&
33 test_i18ngrep "error" actual.err &&
34 test_i18ngrep ! "usage" actual.err
37 test_expect_success 'tag usage error' '
38 test_must_fail git tag --noopt >actual 2>actual.err &&
39 test_line_count = 0 actual &&
40 test_i18ngrep "usage" actual.err
43 test_expect_success 'branch --contains <existent_commit>' '
44 git branch --contains "master" >actual 2>actual.err &&
45 test_i18ngrep "master" actual &&
46 test_line_count = 0 actual.err
49 test_expect_success 'branch --contains <inexistent_commit>' '
50 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
51 test_line_count = 0 actual &&
52 test_i18ngrep "error" actual.err &&
53 test_i18ngrep ! "usage" actual.err
56 test_expect_success 'branch --no-contains <existent_commit>' '
57 git branch --no-contains "master" >actual 2>actual.err &&
58 test_line_count = 0 actual &&
59 test_line_count = 0 actual.err
62 test_expect_success 'branch --no-contains <inexistent_commit>' '
63 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
64 test_line_count = 0 actual &&
65 test_i18ngrep "error" actual.err &&
66 test_i18ngrep ! "usage" actual.err
69 test_expect_success 'branch usage error' '
70 test_must_fail git branch --noopt >actual 2>actual.err &&
71 test_line_count = 0 actual &&
72 test_i18ngrep "usage" actual.err
75 test_expect_success 'for-each-ref --contains <existent_object>' '
76 git for-each-ref --contains "master" >actual 2>actual.err &&
77 test_line_count = 2 actual &&
78 test_line_count = 0 actual.err
81 test_expect_success 'for-each-ref --contains <inexistent_object>' '
82 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
83 test_line_count = 0 actual &&
84 test_i18ngrep "error" actual.err &&
85 test_i18ngrep ! "usage" actual.err
88 test_expect_success 'for-each-ref --no-contains <existent_object>' '
89 git for-each-ref --no-contains "master" >actual 2>actual.err &&
90 test_line_count = 0 actual &&
91 test_line_count = 0 actual.err
94 test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
95 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
96 test_line_count = 0 actual &&
97 test_i18ngrep "error" actual.err &&
98 test_i18ngrep ! "usage" actual.err
101 test_expect_success 'for-each-ref usage error' '
102 test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
103 test_line_count = 0 actual &&
104 test_i18ngrep "usage" actual.err
107 test_done