[PATCH 0 of 5] Add 'unified' tests to the test framework

Dirkjan Ochtman dirkjan at ochtman.nl
Wed Aug 4 02:04:16 CDT 2010


On Tue, Aug 3, 2010 at 18:13, Matt Mackall <mpm at selenic.com> wrote:
> There's not much need to cut and paste command output though. You simply
> write the test without output, then run it, and you end up with the
> unified result in .err. And you either copy that over, or use -i to let
> run-tests do it for you. In other words, just like you'd write a normal
> test.

Ah, right, that's nice.

>>  We could prefix comments with something like # or %.
>> I guess that introduces a chance of ambiguity for output starting with
>> # or %, but we could mitigate that by having a longer prefix, perhaps?
>> (e.g. %%, although I think % is sufficiently rare in our test output
>> and/or should be easy to prevent in most cases).
>
> I think that would reduce the readability substantially. Consider:
>
>
> First we create a repo:
>
>  $ hg init a
>  $ cd a
>
> Then we create a changeset:
>
>  $ echo a > a
>  $ hg ci -Am0
>  adding a
>
> vs
>
> %% First we create a repo:
>
> $ hg init a
> $ cd a
>
> %% Then we create a changeset:
>
> $ echo a > a
> $ hg ci -Am0
> adding a
>
> The first reads exactly how you'd write instructions in an email or
> tutorial.

Hmm, I'd just want to use # and then it looks just like your average
shell script, but I guess we can't do that. I still don't like the
leading whitespace, it's too invisible, making it feel magical somehow
(and a bit of a pain to write), but I guess it's fine.

Cheers,

Dirkjan


More information about the Mercurial-devel mailing list