mbox series

[0/2] tests: catch non-bool GIT_TEST_* values

Message ID 20191122131437.25849-1-szeder.dev@gmail.com (mailing list archive)
Headers show
Series tests: catch non-bool GIT_TEST_* values | expand


SZEDER Gábor Nov. 22, 2019, 1:14 p.m. UTC
On Sat, Sep 07, 2019 at 12:16:37PM +0200, SZEDER Gábor wrote:
> On Fri, Sep 06, 2019 at 03:13:01PM -0400, Jeff King wrote:
> > I wonder if it would be possible for the test suite to catch this.

[i.e. to catch a non-boolean value of a supposedly boolean GIT_TEST_*
environment variable]

> > Not sure if it's worth it.


> Anyway, this is just a long-winded way to say that I think we should
> validate those bools properly and error loudly on an invalid value
> even if it doesn't seem to worth it.

I was playing with a new GIT_TEST boolean environment variable,
mistyped it's value, and then it took me surprisingly long to figure
out why the damn tests were not doing what I thought they should.

So now I'm fairly convinced that it's definitely worth doing.  And the
callsites look much nicer, too.

These patches should apply cleanly both on current 'master' or on
'sg/git-test-boolean' (i.e. the email thread I'm replying to).  We
haven't introduced any new 'git env--helper' invocations in the test
suite/framework since then.

SZEDER Gábor (2):
  tests: add 'test_bool_env' to catch non-bool GIT_TEST_* values
  t5608-clone-2gb.sh: turn GIT_TEST_CLONE_2GB into a bool

 ci/lib.sh               |  2 +-
 t/README                |  9 +++++++++
 t/lib-git-daemon.sh     |  2 +-
 t/lib-git-svn.sh        |  4 ++--
 t/lib-httpd.sh          |  2 +-
 t/t0000-basic.sh        | 34 ++++++++++++++++++++++++++++++++++
 t/t5512-ls-remote.sh    |  2 +-
 t/t5608-clone-2gb.sh    |  2 +-
 t/test-lib-functions.sh | 30 +++++++++++++++++++++++++++++-
 t/test-lib.sh           | 10 +++++-----
 10 files changed, 84 insertions(+), 13 deletions(-)