t4051: rewrite, add more tests

Remove the tests that checked against a fixed result and replace them
with more focused checks of desired properties of the created diffs.
That way we get more detailed and meaningful diagnostics.

Store test file contents in files in a subdirectory in order to avoid
cluttering the test script with them.

Use tagged commits to store the changes to test diff -W against instead
of using changes to the worktree.  Use the worktree instead to try and
apply the generated patch in order to validate it.

Document unwanted features: trailing empty lines, too much context for
appended functions, insufficient context at the end with -U0.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2016-05-31 22:00:38 +02:00
committed by Junio C Hamano
parent 90f7b16b3a
commit d3621de789
6 changed files with 234 additions and 68 deletions

15
t/t4051/appended1.c Normal file
View File

@ -0,0 +1,15 @@
int appended(void) // Begin of first part
{
int i;
char *s = "a string";
printf("%s\n", s);
for (i = 99;
i >= 0;
i--) {
printf("%d bottles of beer on the wall\n", i);
}
printf("End of first part\n");