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

Adrian Buehlmann adrian at cadifra.com
Fri Jun 8 13:46:22 CDT 2012


On 2012-06-08 20:21, Idan Kamara wrote:
> On Fri, Jun 8, 2012 at 9:04 PM, Adrian Buehlmann <adrian at cadifra.com
> <mailto:adrian at cadifra.com>> wrote:
>>
>> 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).
> 
> If this is really necessary (what happens if the test ends in the wrong
> dir anyway?)

At least it is pretty ugly to cd higher up than $TESTTMP, right?

We surely don't want to leave test artifacts outside of $TESTTMP, as
those won't be cleaned up at the end. And having repos inside other
repos is also pretty uncalled for, if it's done unintentionally.

> , injecting it to the end of .t tests from run-tests might
> be nicer.

But then, there is no protection against navigating higher up in-between
the blocks. But that isn't as bad as having no check at all. So, at
least a check at the end would be a compromise and reveal most cd-level
bugs, and still be progress.

So yes, I accept having such a check at the end only.

But this - very good, thanks folks - discussion starts me thinking if I
am trying to attack this problem from the wrong side :-)

Thinking of it, we can easily append a "pwd" at the end of the generated
script and append a last entry "$TESTTMP" to the expected dict in
run-tests.py, thus making this totally automatic.

Nice.

So I think I hereby retract those

  $ pwd
  $TESTTMP

lines.





More information about the Mercurial-devel mailing list