tests: make tests with temporary environment setting portable stable 3.4
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sat, 02 May 2015 00:15:03 +0900
branchstable
changeset 24892 8cc6036bca53
parent 24891 be4915009b09
child 24893 64086e2f5988
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.
tests/test-revset.t
--- a/tests/test-revset.t	Thu Apr 30 23:02:52 2015 -0400
+++ b/tests/test-revset.t	Sat May 02 00:15:03 2015 +0900
@@ -1066,12 +1066,16 @@
     <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')
@@ -1081,8 +1085,6 @@
     <fullreposet+ 0:9>>
   6
 
-(for some reason HGPLAIN and HGPLAINEXCEPT can carry forward)
-
   $ unset HGPLAIN
   $ unset HGPLAINEXCEPT
 
@@ -1097,14 +1099,18 @@
   <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', '.'))