git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 9, 2013, 20:41 UTC
Message-ID
<CAMP44s0Qr54+8hbkZ+jmXB628SCPwg1zZo80UBhFe2PCrgQP4Q@mail.gmail.com>
In-Reply-To
<7vfvwrowd0.fsf@alter.siamese.dyndns.org>
On Sun, Jun 9, 2013 at 3:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> On Sun, Jun 9, 2013 at 2:20 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>>
>>>> On Sun, Jun 9, 2013 at 1:30 PM, Junio C Hamano <gitster@pobox.com> 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
Previous: Junio C HamanoNext: SZEDER Gábor
Message 13 of 24 in “Trivial patches”
  1. 0/3 Trivial patchesFelipe Contreras, Jun 7, 2013
  2. 1/3 sequencer: trivial fixFelipe Contreras, Jun 7, 2013
  3. Junio C HamanoJun 7, 2013
  4. Felipe ContrerasJun 7, 2013
  5. 2/3 test: improve rebase -q testFelipe Contreras, Jun 7, 2013
  6. Duy NguyenJun 8, 2013
  7. Felipe ContrerasJun 8, 2013
  8. Junio C HamanoJun 9, 2013
  9. Felipe ContrerasJun 9, 2013
  10. Junio C HamanoJun 9, 2013
  11. Felipe ContrerasJun 9, 2013
  12. Junio C HamanoJun 9, 2013
  13. Felipe ContrerasJun 9, 2013
  14. SZEDER GáborJun 10, 2013
  15. Junio C HamanoJun 10, 2013
  16. Felipe ContrerasJun 10, 2013
  17. SZEDER GáborJun 10, 2013
  18. Johannes SixtJun 10, 2013
  19. SZEDER GáborJun 10, 2013
  20. Junio C HamanoJun 10, 2013
  21. Philip OakleyJun 9, 2013
  22. Junio C HamanoJun 9, 2013
  23. Jeff KingJun 10, 2013
  24. 3/3 submodule: remove unnecessary checkFelipe Contreras, Jun 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.