mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
6789275d37
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep. This patch was produced more or less with git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /' and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
111 lines
3.2 KiB
Bash
Executable file
111 lines
3.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='Test commands behavior when given invalid argument value'
|
|
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup ' '
|
|
test_commit "v1.0"
|
|
'
|
|
|
|
test_expect_success 'tag --contains <existent_tag>' '
|
|
git tag --contains "v1.0" >actual 2>actual.err &&
|
|
grep "v1.0" actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'tag --contains <inexistent_tag>' '
|
|
test_must_fail git tag --contains "notag" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'tag --no-contains <existent_tag>' '
|
|
git tag --no-contains "v1.0" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'tag --no-contains <inexistent_tag>' '
|
|
test_must_fail git tag --no-contains "notag" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'tag usage error' '
|
|
test_must_fail git tag --noopt >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'branch --contains <existent_commit>' '
|
|
git branch --contains "main" >actual 2>actual.err &&
|
|
test_grep "main" actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'branch --contains <inexistent_commit>' '
|
|
test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'branch --no-contains <existent_commit>' '
|
|
git branch --no-contains "main" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'branch --no-contains <inexistent_commit>' '
|
|
test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'branch usage error' '
|
|
test_must_fail git branch --noopt >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'for-each-ref --contains <existent_object>' '
|
|
git for-each-ref --contains "main" >actual 2>actual.err &&
|
|
test_line_count = 2 actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'for-each-ref --contains <inexistent_object>' '
|
|
test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'for-each-ref --no-contains <existent_object>' '
|
|
git for-each-ref --no-contains "main" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_line_count = 0 actual.err
|
|
'
|
|
|
|
test_expect_success 'for-each-ref --no-contains <inexistent_object>' '
|
|
test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "error" actual.err &&
|
|
test_grep ! "usage" actual.err
|
|
'
|
|
|
|
test_expect_success 'for-each-ref usage error' '
|
|
test_must_fail git for-each-ref --noopt >actual 2>actual.err &&
|
|
test_line_count = 0 actual &&
|
|
test_grep "usage" actual.err
|
|
'
|
|
|
|
test_done
|