[PATCH 01 of 14] tests: roll test-committer.t into test-commit.t

Adrian Buehlmann adrian at cadifra.com
Fri Jun 8 18:04:03 UTC 2012


On 2012-06-08 19:17, Kevin Bullock wrote:
> On Jun 8, 2012, at 12:02 PM, Adrian Buehlmann wrote:
> 
>> On 2012-06-08 18:07, Martin Geisler wrote:
>>>> diff --git a/tests/test-commit.t b/tests/test-commit.t
>>>> --- a/tests/test-commit.t
>>>> +++ b/tests/test-commit.t
>>>> @@ -106,7 +106,8 @@
>>>>   [255]
>>>>
>>>>   $ cd ..
>>>> -
>>>> +  $ pwd
>>>> +  $TESTTMP
>>>
>>> Is this there on purpose? I don't see what it tests.
>>>
>>
>> It is on purpose.
>>
>> Some tests had errors with incorrectly matched cd of the sort
>>
>>   $ cd foo
>>   ...
>>   $ cd ..
>>   ...
>>   $ cd ..
>>
>> which resultet in cd'ing way too high up. That check makes sure that
>> this doesn't happen again if someone edits the test later on.
> 
> Others may have a different opinion on this, but this is the sort of
> thing I'd put in while combining the tests, then take out again before
> submitting the patch.

But that would fail to protect against creating that error again, which
can easily happen if that file is edited again (not just by myself).

I didn't insert that test to protect against errors in my changes alone.
I wanted to make sure it doesn't happen again if someone else edits the
test in the future.

It happens very esily and no one notices it.

My patch fixes a preexisting cd-error, namely this one:
>
>  Issue1049: Hg permits partial commit of merge without warning
>
> -  $ cd ..
>    $ hg init issue1049
>    $ cd issue1049
>    $ echo a > a

Also, I think seeing

  $ pwd
  $TESTTMP

increases readability of the test, as it documents, that the current
directorylevel is again at the top level of the test, which tells the
reader that the next test steps either operate from outside the toy
repos (for example by using -R), or a new toy repo will be created, for
example by cloning or a new hg init.

Furthermore, that claim is not just made with a comment, that claim is
actually checked when the test is run.

If someone later wants to insert a new block of test steps, those

  $ pwd
  $TESTTMP

also make it immediately clear, at which places the current directory is
at the top level again, and thus no risk of making the error of
inadvertantly creating a repo *inside* another, preexisting toy repo.




More information about the Mercurial-devel mailing list