git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brian Henderson <henderson.bj@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Brian Henderson <henderson.bj@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, e@80x24.org
Subject: Re: [PATCH v2 1/3] diff-highlight: add some tests.
Date: Fri, 19 Aug 2016 08:13:32 -0700	[thread overview]
Message-ID: <20160819151332.GB29458@tci.corp.yp.com> (raw)
In-Reply-To: <20160819145123.73hf7ffysy53l3kz@sigill.intra.peff.net>

On Fri, Aug 19, 2016 at 10:51:23AM -0400, Jeff King wrote:
> On Fri, Aug 19, 2016 at 07:42:35AM -0700, Brian Henderson wrote:
> 
> > > > +# PERL is required, but assumed to be present, although not necessarily modern
> > > > +# some tests require 5.8
> > > > +test_expect_success PERL 'name' 'true'
> > > 
> > > If the platform lacks PERL prerequisite, this will simply be
> > > skipped, and if the platform has it, it will always succeed.
> > > 
> > > I am not sure what you are trying to achieve by having this line
> > > here.
> > 
> > I originally didn't have this line, and my comment was referring to the
> > t/README which says
> > 
> >    Even without the PERL prerequisite, tests can assume there is a
> >    usable perl interpreter at $PERL_PATH, though it need not be
> >    particularly modern.
> > 
> > There is current functionality in diff-highlight which requires at least
> > perl 5.8 (the utf8 functions). I was going to add a test for this as
> > well, but I'm not super comfy with multibyte chars.
> 
> Yeah, I'd agree this test would want the PERL prereq. It is not just
> using perl for one-liners in support of the script; it is testing major
> perl functionality that should be skipped if we do not have a modern
> perl available.
> 
> > Eric recommended adding this line, what do you think?
> > 
> > would `test_set_prereq PERL` be better?
> 
> test_set_prereq is for telling the test scripts that we _have_ perl, but
> what I think this script wants to do is test "do we have perl?" and
> abort otherwise. The way to do that is:
> 
>   if ! test_have_prereq PERL
>   then
> 	skip_all='skipping diff-highlight tests; perl not available'
> 	test_done
>   fi
> 
> > > > +test_expect_success 'diff-highlight does not highlight whole line' '
> > > > +	dh_test \
> > > > +		"aaa\nbbb\nccc\n" \
> > > > +		"aaa\n000\nccc\n"
> > > > +'
> > 
> > This (at least to me) is desired. See comment for `sub
> > is_pair_interesting`
> 
> Yeah, that is an intentional behavior, and makes sense to test.
> 
> > > > +test_expect_success 'diff-highlight does not highlight mismatched hunk size' '
> > > > +	dh_test \
> > > > +		"aaa\nbbb\n" \
> > > > +		"aaa\nb0b\nccc\n"
> > > > +'
> > 
> > This is undesired behavior, but currently implemented for simplicity,
> > see `sub show_hunk`
> > 
> > Do they need comments or something?
> 
> Undesired behavior should generally not be tested for. It just makes
> life harder for somebody when they make a change that violates it, and
> they have to figure out "oh, but it's _good_ that I changed that, the
> tests were wrong" (or more likely "I didn't fix it, but it's just broken
> in a different way, and neither is preferable").
> 
> If you want to document known shortcomings, the best thing to do is show
> what you'd _like_ to have happen, and mark it as test_expect_failure;
> the test scripts show this as a known-breakage, and somebody later who
> fixes it can flip the "failure" to "success".
> 
> -Peff

all very helpful, thanks!

  reply	other threads:[~2016-08-19 15:14 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30 15:11 [PATCH 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-07-30 15:11 ` [PATCH 1/3] diff-highlight: add some tests Brian Henderson
2016-08-10  8:56   ` Eric Wong
2016-08-15 16:20     ` Brian Henderson
2016-08-15 16:25       ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-08-19 21:19       ` Eric Wong
2016-08-19 21:23         ` Jeff King
2016-08-17 15:31     ` [PATCH v2 1/3] diff-highlight: add some tests Brian Henderson
2016-08-17 19:09       ` Junio C Hamano
2016-08-19 14:42         ` Brian Henderson
2016-08-19 14:51           ` Jeff King
2016-08-19 15:13             ` Brian Henderson [this message]
2016-08-19 17:08             ` [PATCH v3 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-08-19 17:08             ` [PATCH v3 1/3] diff-highlight: add some tests Brian Henderson
2016-08-19 18:10               ` Junio C Hamano
2016-08-19 19:30                 ` Brian Henderson
2016-08-19 20:56                   ` Eric Wong
2016-08-19 20:18                 ` [PATCH] " Brian Henderson
2016-08-19 20:44                   ` Junio C Hamano
2016-08-19 21:04                     ` Jeff King
2016-08-19 22:31                       ` Junio C Hamano
2016-08-22 15:55                         ` Brian Henderson
2016-08-23  4:12                           ` Jeff King
2016-08-29 17:33                             ` [PATCH v4 0/3] diff-highlight: add support for --graph option Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 1/3] diff-highlight: add some tests Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 3/3] diff-highlight: add support for " Brian Henderson
2016-08-29 21:37                               ` [PATCH v4 0/3] diff-highlight: add support for --graph option Junio C Hamano
2016-08-30 14:07                                 ` Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 1/3] diff-highlight: add some tests Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 3/3] diff-highlight: add support for " Brian Henderson
2016-08-31  5:02                                   ` [PATCH v4 0/3] diff-highlight: add support for --graph option Jeff King
2016-08-31  5:02                                     ` [PATCH 1/3] diff-highlight: ignore test cruft Jeff King
2016-08-31  5:03                                     ` [PATCH 2/3] diff-highlight: add multi-byte tests Jeff King
2016-08-31  5:05                                     ` [PATCH 3/3] diff-highlight: avoid highlighting combined diffs Jeff King
2016-08-30  8:11                               ` [PATCH v4 0/3] diff-highlight: add support for --graph option Jeff King
2016-08-19 21:05                   ` [PATCH] diff-highlight: add some tests Junio C Hamano
2016-08-19 17:08             ` [PATCH v3 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-19 18:25               ` Junio C Hamano
2016-08-19 17:08             ` [PATCH v3 3/3] diff-highlight: add support for " Brian Henderson
2016-08-19 18:27               ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 2/3] diff-highlight: add failing test for handling " Brian Henderson
2016-08-17 19:18       ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 3/3] diff-highlight: add support for " Brian Henderson
2016-08-19 14:37       ` Jeff King
2016-08-15 16:40   ` [PATCH 1/3] diff-highlight: add some tests Lars Schneider
2016-08-16 20:48     ` Junio C Hamano
2016-08-24  9:38       ` Lars Schneider
2016-07-30 15:11 ` [PATCH 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-07-30 15:11 ` [PATCH 3/3] diff-highlight: add support for " Brian Henderson
2016-08-01 17:16   ` Junio C Hamano
2016-08-04 15:02     ` [PATCH] diff-highlight: Add comment for our assumption about " Brian Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160819151332.GB29458@tci.corp.yp.com \
    --to=henderson.bj@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).