Re: [PATCH 2/3] test: improve rebase -q test
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 10, 2013, 15:56 UTC
- Message-ID
- <7vppvuj6wl.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130610093904.GG2091@goldbirke>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 7 quoted lines
> On Sun, Jun 09, 2013 at 03:41:54PM -0500, Felipe Contreras wrote: >> There >> will not be a need for test_string_must_be_empty() just like there's >> no need for test_string_cmp(). > > Actually, if there were a test_string_cmp(), that would be the test > helper function I used most often.
Hmm, there indeed are quite a many "At this point, the variable's value must be this" in the test scripts. With things like this:
t/t0002-gitfile.sh: test "$SHA" = "$(git rev-list HEAD)"
we can go to the trash directory upon seeing a failure to run the command used on the RHS, but the value in $SHA is cumbersome to find out (either running it under sh -x or insert an extra echo before it), so such a helper function may be useful.
Do you really need a general comparison ("does A sort before B") or just equality? If the latter, test_string_equal (or even string_equal) might be a better name for it.
By the way, test_cmp() is a replacement for the "cmp" command and that is why it does not have "file" in its name.