Re: [PATCH] Add tests for git log --pretty, --format and --oneline.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 25, 2009, 09:54 UTC
- Message-ID
- <7vtz6i4zah.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1235509597-18336-1-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 6 quoted lines
> More specifically; --pretty=format, tformat and new %foo shortcut. > > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> > --- > t/t4202-log.sh | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-)
Because 4202 seems to be about testing the log functionality and they rely on correctly working format output to verify other aspects of the operation of "git log", I initially was not sure if this is the right place to add these new tests. After looking around I didn't find any existing test that checks the various --pretty output formats that the new tests can be added, so this probably is as good a place as any.
Show 16 quoted lines
> diff --git a/t/t4202-log.sh b/t/t4202-log.sh > index 7b976ee..f1287fe 100755 > --- a/t/t4202-log.sh > +++ b/t/t4202-log.sh > @@ -37,6 +37,46 @@ test_expect_success setup ' > > ' > > +echo -ne "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect > +test_expect_success 'pretty' ' > + > + git log --pretty="format:%s" > actual && > + test_cmp expect actual > +' > + > +echo -ne "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
We avoid "echo -e" to cater to people whose echo does not like it and instead use printf for things like this.
Other than that, the patch looked Ok. I queued it with a minor fixup.
Thanks.