From 54cc5d29a0590c47c6f32d15c867c0199fdd672a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 24 Nov 2014 09:43:29 -0800 Subject: [PATCH 1/2] SubmittingPatches: refer to t/README for tests There are general guidelines for writing good tests in t/README but neither SubmittingPatches nor CodingGuidelines refers to it, which makes the document easy to be missed. Signed-off-by: Junio C Hamano --- Documentation/SubmittingPatches | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index e6d46edbe7376a..bfcf1d1b1f5568 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -57,7 +57,8 @@ change, the approach taken by the change, and if relevant how this differs substantially from the prior version, are all good things to have. -Make sure that you have tests for the bug you are fixing. +Make sure that you have tests for the bug you are fixing. See +t/README for guidance. When adding a new feature, make sure that you have new tests to show the feature triggers the new behaviour when it should, and to show the From 53de742470bdf160a8412d7a2e9c30545db63fac Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 24 Nov 2014 09:47:07 -0800 Subject: [PATCH 2/2] t/README: justify why "! grep foo" is sufficient We require use of test_must_fail to check expected non-zero exit by Git itself, but discourage test_must_fail to be used for checking exit status of non Git commands that are supplied by the system. The current text explains the reason for the former but not the latter. Signed-off-by: Junio C Hamano --- t/README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/README b/t/README index caeeb9dedc4694..1d51d0e0be7507 100644 --- a/t/README +++ b/t/README @@ -335,7 +335,8 @@ Don't: dies in an unexpected way (e.g. segfault). On the other hand, don't use test_must_fail for running regular - platform commands; just use '! cmd'. + platform commands; just use '! cmd'. We are not in the business + of verifying that the world given to us sanely works. - use perl without spelling it as "$PERL_PATH". This is to help our friends on Windows where the platform Perl often adds CR before