diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-08-12 14:18:31 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-08-12 14:18:32 -0700 |
| commit | 55d20e19850ce18a387f961fcfab29f892c4fbb0 (patch) | |
| tree | a79a4ff2aeb786563546951fb104bd00a25c0e9e | |
| parent | Merge branch 'rj/t6137-cygwin-fix' into next (diff) | |
| parent | t5304: move `prune -h` test from t1517 (diff) | |
| download | git-55d20e19850ce18a387f961fcfab29f892c4fbb0.tar.gz git-55d20e19850ce18a387f961fcfab29f892c4fbb0.zip | |
Merge branch 'ua/t1517-short-help-tests' into next
Test shuffling.
* ua/t1517-short-help-tests:
t5304: move `prune -h` test from t1517
t5200: move `update-server-info -h` test from t1517
t/t1517: automate `git subcmd -h` tests outside a repository
| -rwxr-xr-x | t/t1517-outside-repo.sh | 40 | ||||
| -rwxr-xr-x | t/t5200-update-server-info.sh | 5 | ||||
| -rwxr-xr-x | t/t5304-prune.sh | 5 |
3 files changed, 37 insertions, 13 deletions
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh index 8f59b867f2..3dc602872a 100755 --- a/t/t1517-outside-repo.sh +++ b/t/t1517-outside-repo.sh @@ -107,18 +107,32 @@ test_expect_success LIBCURL 'remote-http outside repository' ' test_grep "^error: remote-curl" actual ' -test_expect_success 'update-server-info does not crash with -h' ' - test_expect_code 129 git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage && - test_expect_code 129 nongit git update-server-info -h >usage && - test_grep "[Uu]sage: git update-server-info " usage -' - -test_expect_success 'prune does not crash with -h' ' - test_expect_code 129 git prune -h >usage && - test_grep "[Uu]sage: git prune " usage && - test_expect_code 129 nongit git prune -h >usage && - test_grep "[Uu]sage: git prune " usage -' +for cmd in $(git --list-cmds=main) +do + cmd=${cmd%.*} # strip .sh, .perl, etc. + case "$cmd" in + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ + http-backend | http-fetch | http-push | init-db | \ + merge-octopus | merge-one-file | merge-resolve | mergetool | \ + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \ + remote-http | remote-https | replay | send-email | \ + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ + upload-archive--writer | upload-pack | web--browse | whatchanged) + expect_outcome=expect_failure ;; + *) + expect_outcome=expect_success ;; + esac + case "$cmd" in + instaweb) + prereq=PERL ;; + *) + prereq= ;; + esac + test_$expect_outcome $prereq "'git $cmd -h' outside a repository" ' + test_expect_code 129 nongit git $cmd -h >usage && + test_grep "[Uu]sage: git $cmd " usage + ' +done test_done diff --git a/t/t5200-update-server-info.sh b/t/t5200-update-server-info.sh index 8365907055..a551e955b5 100755 --- a/t/t5200-update-server-info.sh +++ b/t/t5200-update-server-info.sh @@ -46,4 +46,9 @@ test_expect_success 'midx does not create duplicate pack entries' ' test_must_be_empty dups ' +test_expect_success 'update-server-info does not crash with -h' ' + test_expect_code 129 git update-server-info -h >usage && + test_grep "[Uu]sage: git update-server-info " usage +' + test_done diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index 1f1f664871..2be7cd30de 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -364,4 +364,9 @@ test_expect_success 'gc.recentObjectsHook' ' git cat-file -p $BLOB ' +test_expect_success 'prune does not crash with -h' ' + test_expect_code 129 git prune -h >usage && + test_grep "[Uu]sage: git prune " usage +' + test_done |
