X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2FREADME;h=0d1183c3e69904e9e3543d757f14f10c629e199b;hb=7e7db5e4520388d3a6f1efbe2f7a29d43bd06a2b;hp=b40403d0c0e9888a7f1fb67ef3c87dbb81547827;hpb=2fac6a4b93c29c0e7226337d76097ea1e61e072d;p=git.git diff --git a/t/README b/t/README index b40403d0c..0d1183c3e 100644 --- a/t/README +++ b/t/README @@ -231,6 +231,91 @@ This test harness library does the following things: consistently when command line arguments --verbose (or -v), --debug (or -d), and --immediate (or -i) is given. +Do's, don'ts & things to keep in mind +------------------------------------- + +Here are a few examples of things you probably should and shouldn't do +when writing tests. + +Do: + + - Put all code inside test_expect_success and other assertions. + + Even code that isn't a test per se, but merely some setup code + should be inside a test assertion. + + - Chain your test assertions + + Write test code like this: + + git merge foo && + git push bar && + test ... + + Instead of: + + git merge hla + git push gh + test ... + + That way all of the commands in your tests will succeed or fail. If + you must ignore the return value of something (e.g., the return + after unsetting a variable that was already unset is unportable) it's + best to indicate so explicitly with a semicolon: + + unset HLAGH; + git merge hla && + git push gh && + test ... + +Don't: + + - exit() within a