Re: [PATCH 2/3] test: improve rebase -q test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 9, 2013 at 3:35 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
>
>> On Sun, Jun 9, 2013 at 2:20 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
>>>
>>>> On Sun, Jun 9, 2013 at 1:30 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>>>
>>>>> --- a/t/test-lib-functions.sh
>>>>> +++ b/t/test-lib-functions.sh
>>>>> @@ -606,6 +606,18 @@ test_cmp() {
>>>>>         $GIT_TEST_CMP "$@"
>>>>>  }
>>>>>
>>>>> +# Check if the file expected to be empty is indeed empty, and barfs
>>>>> +# otherwise.
>>>>> +
>>>>> +test_output_must_be_empty () {
>>>>
>>>> Why such a big name? test_empty() does the trick.
>>>
>>> Primarily in order to avoid that exact name "test_empty" that others
>>> may want to use for a helper to check that the contents of a string
>>> variable is empty.
>>
>> Which is never going to happen.
>
> For anything, a failure from
>
>         test -z "$mustbeemptystring"
>
> in the test suite is much harder to diagnose because there is
> nothing left in the trash directory to inspect, as opposed to
>
>         test ! -s "$mustbeemptyfile"
>
> where you can just go there and inspect yourself.

Except that it's usually gone. And I challenge you to find a instance
where there's a test -z "$mustbeemptystring" that throws a test
failure. It will take you time to find it (if there's any).

Moreover, by that rationale, we should call test_cmp, test_file_cmp,
but there's no need, because that's rarely needed (if at all). There
will not be a need for test_string_must_be_empty() just like there's
no need for test_string_cmp().

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]