[PATCH STABLE] tests: make tests with temporary environment setting portable

Matt Mackall mpm at selenic.com
Fri May 1 14:51:01 CDT 2015


On Fri, 2015-05-01 at 18:48 +0000, Martin von Zweigbergk wrote:
> On Fri, May 1, 2015 at 8:21 AM FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> wrote:
> 
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1430493303 -32400
> > #      Sat May 02 00:15:03 2015 +0900
> > # Branch stable
> > # Node ID 7086e9cfe82c6c5c08ad634aa8cfb74fb67b01d7
> > # Parent  ab9390165429b7891364c0d454f3ae3b04b00c7d
> > tests: make tests with temporary environment setting portable
> >
> > With "dash" (as "/bin/sh" on Debian GNU/Linux), command execution in
> > "ENV=val foo bar" style doesn't work as expect in test script files,
> > if "foo" is user-defined function: it works fine, if "foo" is existing
> > commands like "hg".
> >
> > 09049042ab99 introduced tests for HGPLAIN and HGPLAINEXCEPT into
> > test-revset.t, and all of them are in such style.
> >
> > This patch doesn't:
> >
> >   - add explicit unsetting for HGPLAIN and HGPLAINEXCEPT
> >
> >     they are already introduced by 09049042ab99
> >
> >   - write assignment and exporting in one line
> >
> >     "ENV=val; export ENV" for two or more environment variables in one
> >     line causes failure of test-check-code-hg.t: it is recognized as
> >     "don't export and assign at once" unfortunately.
> >
> > diff --git a/tests/test-revset.t b/tests/test-revset.t
> > --- a/tests/test-revset.t
> > +++ b/tests/test-revset.t
> > @@ -1066,12 +1066,16 @@ aliases:
> >      <fullreposet+ 0:9>>
> >    6
> >
> > -  $ HGPLAIN=1 try m
> > +  $ HGPLAIN=1
> > +  $ export HGPLAIN
> > +  $ try m
> >    ('symbol', 'm')
> >    abort: unknown revision 'm'!
> >    [255]
> >
> > -  $ HGPLAIN=1 HGPLAINEXCEPT=revsetalias try m
> > +  $ HGPLAINEXCEPT=revsetalias
> > +  $ export HGPLAINEXCEPT
> > +  $ try m
> >    ('symbol', 'm')
> >    (func
> >      ('symbol', 'merge')
> >
> 
> Also drop the "(for some reason HGPLAIN and HGPLAINEXCEPT can carry
> forward)" comment now? It seems quite expected after this patch.

I've queued this for stable with Martin's suggestion rolled in, thanks.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list