Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t0041-usage.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t0041-usage.sh` 117 lines ยท 3515 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='Test commands behavior when given invalid argument value' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 test_expect_success 'setup ' ' 11 test_commit "v1.0" 12 ' 13 14 test_expect_success 'tag --contains ' ' 15 git tag --contains "v1.0" >actual 2>actual.err && 16 test_grep "v1.0" actual && 17 test_line_count = 0 actual.err 18 ' 19 20 test_expect_success 'tag --contains ' ' 21 test_must_fail git tag --contains "notag" >actual 2>actual.err && 22 test_line_count = 0 actual && 23 test_grep "error" actual.err && 24 test_grep ! "usage" actual.err 25 ' 26 27 test_expect_success 'tag --no-contains ' ' 28 git tag --no-contains "v1.0" >actual 2>actual.err && 29 test_line_count = 0 actual && 30 test_line_count = 0 actual.err 31 ' 32 33 test_expect_success 'tag --no-contains ' ' 34 test_must_fail git tag --no-contains "notag" >actual 2>actual.err && 35 test_line_count = 0 actual && 36 test_grep "error" actual.err && 37 test_grep ! "usage" actual.err 38 ' 39 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_grep "usage" actual.err 44 ' 45 46 test_expect_success 'branch --contains ' ' 47 git branch --contains "main" >actual 2>actual.err && 48 test_grep "main" actual && 49 test_line_count = 0 actual.err 50 ' 51 52 test_expect_success 'branch --contains ' ' 53 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && 54 test_line_count = 0 actual && 55 test_grep "error" actual.err && 56 test_grep ! "usage" actual.err 57 ' 58 59 test_expect_success 'branch --no-contains ' ' 60 git branch --no-contains "main" >actual 2>actual.err && 61 test_line_count = 0 actual && 62 test_line_count = 0 actual.err 63 ' 64 65 test_expect_success 'branch --no-contains ' ' 66 test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && 67 test_line_count = 0 actual && 68 test_grep "error" actual.err && 69 test_grep ! "usage" actual.err 70 ' 71 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_grep "usage" actual.err 76 ' 77 78 test_expect_success 'for-each-ref --contains ' ' 79 git for-each-ref --contains "main" >actual 2>actual.err && 80 test_line_count = 2 actual && 81 test_line_count = 0 actual.err 82 ' 83 84 test_expect_success 'for-each-ref --contains ' ' 85 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && 86 test_line_count = 0 actual && 87 test_grep "error" actual.err && 88 test_grep ! "usage" actual.err 89 ' 90 91 test_expect_success 'for-each-ref --no-contains ' ' 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 95 ' 96 97 test_expect_success 'for-each-ref --no-contains ' ' 98 test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && 99 test_line_count = 0 actual && 100 test_grep "error" actual.err && 101 test_grep ! "usage" actual.err 102 ' 103 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_grep "usage" actual.err 108 ' 109 110 test_expect_success 'git --shallow-file without a value' ' 111 test_must_fail git --shallow-file >actual 2>actual.err && 112 test_line_count = 0 actual && 113 test_grep "no file given for " actual.err && 114 test_grep "usage" actual.err 115 ' 116 117 test_done