[PATCH 13 of 14] tests/hghave: implement #if true / #if false

Adrian Buehlmann adrian at cadifra.com
Fri Jun 8 13:50:29 UTC 2012


On 2012-06-08 15:27, Augie Fackler wrote:
> 
> On Jun 8, 2012, at 8:18 AM, Adrian Buehlmann wrote:
> 
>> # HG changeset patch
>> # User Adrian Buehlmann <adrian at cadifra.com>
>> # Date 1339161065 -7200
>> # Node ID fef7294bb8184c9c5a2a542148fbb15de62f31a4
>> # Parent  60fed8d848740a23b8539ea5f1e11c29229179db
>> tests/hghave: implement #if true / #if false
>>
>> For unconditionally testing / skipping a section. Useful for testing the test
>> infrastructure in test-run-tests.t and for debugging/developing tests.
>>
>> diff --git a/tests/hghave b/tests/hghave
>> --- a/tests/hghave
>> +++ b/tests/hghave
>> @@ -241,6 +241,8 @@
>>     return os.getenv('MSYSTEM')
>>
>> checks = {
>> +    "true": (lambda: True, "yak shaving"),
>> +    "false": (lambda: False, "nail clipper"),
> 
> Looks like placeholder docstrings?

Actually, these texts are fully intentional. But I'll gladly take the
ones you provide instead and resend the patch.

I know it's a bit silly.

I tried to come up with more professional sounding texts, but there are
so many negations and skipped and whatnot twists that I gave up.
Everything sounded more or less meaningless in one or another way.

>>     "baz": (has_baz, "GNU Arch baz client"),
>>     "bzr": (has_bzr, "Canonical's Bazaar client"),
>>     "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
>> diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
>> --- a/tests/test-run-tests.t
>> +++ b/tests/test-run-tests.t
>> @@ -52,9 +52,27 @@
>>   $ echo 'foo (re)'
>>   foo (re)
>>
>> +testing hghave
>> +
>> +  $ "$TESTDIR/hghave" true
>> +  $ "$TESTDIR/hghave" false
>> +  skipped: missing feature: nail clipper
>> +  [1]

The text wanted here is a description of a feature that's alway missing
by definition, something that we will never ever have. Like just your
computer will probably never clip your nails.

>> +  $ "$TESTDIR/hghave" no-true
>> +  skipped: system supports yak shaving
>> +  [1]

Too many negations and skipped to explain. So, propose whatever you
like. I'll it.

Hint: every computer can be used for wasting your time (i.e. yak
shaving). So the "yak shaving" feature is always there, by definition.

Bike shedding session opened! :-)

>> +  $ "$TESTDIR/hghave" no-false
>> +
>> Conditional sections based on hghave:
>>
>> -#if fifo no-fifo
>> +#if true
>> +  $ echo tested
>> +  tested
>> +#else
>> +  $ echo skipped
>> +#endif
>> +
>> +#if false
>>   $ echo skipped
>> #else
> 
> Shiny. I wonder if this will be useful for out of tree extensions too.
> 
>>   $ echo tested



More information about the Mercurial-devel mailing list