@@ -401,13 +401,13 @@ This test harness library does the following things:
401401 consistently when command line arguments --verbose (or -v),
402402 --debug (or -d), and --immediate (or -i) is given.
403403
404- Do's, don'ts & things to keep in mind
405- -------------------------------------
404+ Do's & don'ts
405+ -------------
406406
407407Here are a few examples of things you probably should and shouldn't do
408408when writing tests.
409409
410- Do:
410+ Here are the "do's:"
411411
412412 - Put all code inside test_expect_success and other assertions.
413413
@@ -452,43 +452,48 @@ Do:
452452 Windows, where the shell (MSYS bash) mangles absolute path names.
453453 For details, see the commit message of 4114156ae9.
454454
455- Don't:
455+ - Remember that inside the <script> part, the standard output and
456+ standard error streams are discarded, and the test harness only
457+ reports "ok" or "not ok" to the end user running the tests. Under
458+ --verbose, they are shown to help debug the tests.
459+
460+ And here are the "don'ts:"
456461
457- - exit() within a <script> part.
462+ - Don't exit() within a <script> part.
458463
459464 The harness will catch this as a programming error of the test.
460465 Use test_done instead if you need to stop the tests early (see
461466 "Skipping tests" below).
462467
463- - use '! git cmd' when you want to make sure the git command exits
464- with failure in a controlled way by calling "die()". Instead,
468+ - Don't use '! git cmd' when you want to make sure the git command
469+ exits with failure in a controlled way by calling "die()". Instead,
465470 use 'test_must_fail git cmd'. This will signal a failure if git
466471 dies in an unexpected way (e.g. segfault).
467472
468473 On the other hand, don't use test_must_fail for running regular
469474 platform commands; just use '! cmd'. We are not in the business
470475 of verifying that the world given to us sanely works.
471476
472- - use perl without spelling it as "$PERL_PATH". This is to help our
473- friends on Windows where the platform Perl often adds CR before
477+ - Don't use perl without spelling it as "$PERL_PATH". This is to help
478+ our friends on Windows where the platform Perl often adds CR before
474479 the end of line, and they bundle Git with a version of Perl that
475480 does not do so, whose path is specified with $PERL_PATH. Note that we
476481 provide a "perl" function which uses $PERL_PATH under the hood, so
477482 you do not need to worry when simply running perl in the test scripts
478483 (but you do, for example, on a shebang line or in a sub script
479484 created via "write_script").
480485
481- - use sh without spelling it as "$SHELL_PATH", when the script can
482- be misinterpreted by broken platform shell (e.g. Solaris).
486+ - Don't use sh without spelling it as "$SHELL_PATH", when the script
487+ can be misinterpreted by broken platform shell (e.g. Solaris).
483488
484- - chdir around in tests. It is not sufficient to chdir to
489+ - Don't chdir around in tests. It is not sufficient to chdir to
485490 somewhere and then chdir back to the original location later in
486491 the test, as any intermediate step can fail and abort the test,
487492 causing the next test to start in an unexpected directory. Do so
488493 inside a subshell if necessary.
489494
490- - save and verify the standard error of compound commands, i.e. group
491- commands, subshells, and shell functions (except test helper
495+ - Don't save and verify the standard error of compound commands, i.e.
496+ group commands, subshells, and shell functions (except test helper
492497 functions like 'test_must_fail') like this:
493498
494499 ( cd dir && git cmd ) 2>error &&
@@ -503,7 +508,7 @@ Don't:
503508 ( cd dir && git cmd 2>../error ) &&
504509 test_cmp expect error
505510
506- - Break the TAP output
511+ - Don't break the TAP output
507512
508513 The raw output from your test may be interpreted by a TAP harness. TAP
509514 harnesses will ignore everything they don't know about, but don't step
@@ -523,13 +528,6 @@ Don't:
523528 but the best indication is to just run the tests with prove(1),
524529 it'll complain if anything is amiss.
525530
526- Keep in mind:
527-
528- - Inside the <script> part, the standard output and standard error
529- streams are discarded, and the test harness only reports "ok" or
530- "not ok" to the end user running the tests. Under --verbose, they
531- are shown to help debugging the tests.
532-
533531
534532Skipping tests
535533--------------
0 commit comments