diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-30 18:01:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-30 18:01:11 -0700 |
commit | a5bf611cc4f14f062cd74965deafe617048bff05 (patch) | |
tree | 47dd4d166bf8dc324a619d591ad03b918a93211a /t/t9800-git-p4-basic.sh | |
parent | Merge branch 'jd/prompt-upstream-mark' (diff) | |
parent | http tests: use "test_hook" for "smart" and "dumb" http tests (diff) | |
download | tgif-a5bf611cc4f14f062cd74965deafe617048bff05.tar.xz |
Merge branch 'ab/hook-tests-updates'
Update tests around the use of hook scripts.
* ab/hook-tests-updates:
http tests: use "test_hook" for "smart" and "dumb" http tests
proc-receive hook tests: use "test_hook" instead of "write_script"
tests: extend "test_hook" for "rm" and "chmod -x", convert "$HOOK"
tests: use "test_hook" for misc "mkdir -p" and "chmod" cases
tests: change "mkdir -p && write_script" to use "test_hook"
tests: change "cat && chmod +x" to use "test_hook"
gc + p4 tests: use "test_hook", remove sub-shells
fetch+push tests: use "test_hook" and "test_when_finished" pattern
bugreport tests: tighten up "git bugreport -s hooks" test
tests: assume the hooks are disabled by default
http tests: don't rely on "hook/post-update.sample"
hook tests: turn exit code assertions into a loop
test-lib-functions: add and use a "test_hook" wrapper
Diffstat (limited to 't/t9800-git-p4-basic.sh')
-rwxr-xr-x | t/t9800-git-p4-basic.sh | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh index 806005a793..8b30062c0c 100755 --- a/t/t9800-git-p4-basic.sh +++ b/t/t9800-git-p4-basic.sh @@ -277,16 +277,21 @@ test_expect_success 'run hook p4-pre-submit before submit' ' git commit -m "add hello.txt" && git config git-p4.skipSubmitEdit true && git p4 submit --dry-run >out && - grep "Would apply" out && - mkdir -p .git/hooks && - write_script .git/hooks/p4-pre-submit <<-\EOF && - exit 0 - EOF + grep "Would apply" out + ) && + test_hook -C "$git" p4-pre-submit <<-\EOF && + exit 0 + EOF + ( + cd "$git" && git p4 submit --dry-run >out && - grep "Would apply" out && - write_script .git/hooks/p4-pre-submit <<-\EOF && - exit 1 - EOF + grep "Would apply" out + ) && + test_hook -C "$git" --clobber p4-pre-submit <<-\EOF && + exit 1 + EOF + ( + cd "$git" && test_must_fail git p4 submit --dry-run >errs 2>&1 && ! grep "Would apply" errs ) |