[PATCH STABLE] tests: make tests with temporary environment setting portable
Martin von Zweigbergk
martinvonz at google.com
Fri May 1 13:48:48 CDT 2015
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.
> @@ -1097,14 +1101,18 @@ aliases:
> <baseset+ [8]>
> 8
>
> - $ HGPLAIN=1 try 'p2(.)'
> + $ HGPLAIN=1
> + $ export HGPLAIN
> + $ try 'p2(.)'
> (func
> ('symbol', 'p2')
> ('symbol', '.'))
> * set:
> <baseset+ []>
>
> - $ HGPLAIN=1 HGPLAINEXCEPT=revsetalias try 'p2(.)'
> + $ HGPLAINEXCEPT=revsetalias
> + $ export HGPLAINEXCEPT
> + $ try 'p2(.)'
> (func
> ('symbol', 'p2')
> ('symbol', '.'))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150501/66d7db20/attachment.html>
More information about the Mercurial-devel
mailing list