[PATCH] test-subrepo-git.t: adapt for Windows

Mads Kiilerich mads at kiilerich.com
Tue Jun 19 18:21:42 CDT 2012


Eduard-Cristian Stefan wrote, On 06/20/2012 01:05 AM:
> On 2012-06-20 01:41, Eduard-Cristian Stefan wrote:
>> On 2012-06-20 00:22, Adrian Buehlmann wrote:
>>>> +  $ hg forget 'notafile'
>>>> +  notafile: No such file or directory
>>>>     [1]
>>>> +#elsif
>>>
>>> That's basically a syntax error here (only #else is implemented), but
>>> run-tests.py will parse it as a comment, it will thus continue to skip
>>> the following commands (and output lines) if run on Windows, until the
>>> #endif is reached. In other words: your #elsif is ignored.
>>
>> My mistake.
>
> But why does it enter the #elseif branch? For:
>
>     #if unix-permissions
>       $ hg forget 'notafile'
>       $ hg version
>       notafile: No such file or directory
>       [1]
>     #elseif
>       $ hg forget 'notafile'
>       $ hg version
>       notafile: * (glob)
>       [1]
>     #endif
>
> the result is:
>
>     --- d:\hg\tests\test-subrepo-git.t
>     +++ d:\hg\tests\test-subrepo-git.t.err
>     @@ -518,9 +518,15 @@
>        [1]
>      #elseif
>        $ hg forget 'notafile'
>     +  notafile: The system cannot find the file specified
>     +  [1]
>        $ hg version
>     -  notafile: * (glob)
>     -  [1]
>     +  Mercurial Distributed SCM (version 
> 2.2.2+133-132ea1736751+20120619)
>     +  (see http://mercurial.selenic.com for more information)
>     +
>     +  Copyright (C) 2005-2012 Matt Mackall and others
>     +  This is free software; see the source for copying conditions. 
> There is NO
>     +  warranty; not even for MERCHANTABILITY or FITNESS FOR A 
> PARTICULAR PURPOSE.
>      #endif
>
>        $ cd ..
>
>     ERROR: d:\hg\tests\test-subrepo-git.t output changed
>     !
>     Failed test-subrepo-git.t: output changed
>     # Ran 1 tests, 0 skipped, 1 failed.
>
> Is it because #elseif is treated like an #else ?

Yes, it is because the parser is stupid. Garbage in, garbage out ... and 
in this case the garbage out happens to be what you want, but don't rely 
on that.

I will improve the parser so it is a little bit less stupid and more strict.

/Mads


More information about the Mercurial-devel mailing list