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

Mads Kiilerich mads at kiilerich.com
Fri Jun 8 15:07:06 CDT 2012


Adrian Buehlmann wrote, On 06/08/2012 07:02 PM:
> 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.

I think it would be better to make it a general rule to avoid doing 'cd 
..' and instead do 'cd $TESTDIR'.

That would also protect against the situation where a directory creation 
(clone?) and the following 'cd' for some reason fails and the matching 
'cd ..' then escapes from TESTDIR and can cause various degrees of damage.

Manually spreading 'pwd' everywhere doesn't scale ... and is an 
unrelated change, FWIW.

/Mads


More information about the Mercurial-devel mailing list