2 new revisions:

Revision: 5ca673452027
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon Jan 27 12:52:18 2014 UTC
Log:      OS.Append To Environment Variable: Support custom separator....
http://code.google.com/p/robotframework/source/detail?r=5ca673452027

Revision: daf145a5348d
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon Jan 27 12:52:26 2014 UTC
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=daf145a5348d

==============================================================================
Revision: 5ca673452027
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon Jan 27 12:52:18 2014 UTC
Log:      OS.Append To Environment Variable: Support custom separator.

Update issue 1636
Status: Done
Added support for custom separator. Agreed with others that the original name
is good. This isssue is done.
http://code.google.com/p/robotframework/source/detail?r=5ca673452027

Modified:
 /atest/robot/standard_libraries/operating_system/env_vars.txt
 /atest/testdata/standard_libraries/operating_system/env_vars.txt
 /src/robot/libraries/OperatingSystem.py

=======================================
--- /atest/robot/standard_libraries/operating_system/env_vars.txt Mon Jan 27 07:47:12 2014 UTC +++ /atest/robot/standard_libraries/operating_system/env_vars.txt Mon Jan 27 12:52:18 2014 UTC
@@ -12,6 +12,12 @@

 Append To Environment Variable
     Check test case    ${TEST NAME}
+
+Append To Environment Variable With Custom Separator
+    Check test case    ${TEST NAME}
+
+Append To Environment Variable With Invalid Config
+    Check test case    ${TEST NAME}

 Remove Environment Variable
     Check test case    ${TEST NAME}
=======================================
--- /atest/testdata/standard_libraries/operating_system/env_vars.txt Mon Jan 27 07:47:12 2014 UTC +++ /atest/testdata/standard_libraries/operating_system/env_vars.txt Mon Jan 27 12:52:18 2014 UTC
@@ -30,6 +30,16 @@
     Append To Environment Variable    ${NAME}    second    third
     Should Be Equal    %{${NAME}}    first${:}second${:}third

+Append To Environment Variable With Custom Separator
+    Append To Environment Variable    ${NAME}    first    separator=-
+    Should Be Equal    %{${NAME}}    first
+ Append To Environment Variable ${NAME} second 3rd\=x separator=-
+    Should Be Equal    %{${NAME}}    first-second-3rd=x
+
+Append To Environment Variable With Invalid Config
+ [Documentation] FAIL Configuration 'not=ok' or 'these=are' not accepted. + Append To Environment Variable ${NAME} value these=are not=ok
+
 Remove Environment Variable
     Set Environment Variable    ${NAME}    Hello
     Remove Environment Variable    ${NAME}
=======================================
--- /src/robot/libraries/OperatingSystem.py     Mon Jan 27 07:47:12 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py     Mon Jan 27 12:52:18 2014 UTC
@@ -926,19 +926,26 @@
         set_env_var(name, value)
self._info("Environment variable '%s' set to value '%s'" % (name, value))

-    def append_to_environment_variable(self, name, *values):
+    def append_to_environment_variable(self, name, *values, **config):
         """Appends given `values` to environment variable `name`.

If the environment variable already exists, values are added after it,
-        otherwise a new environment variable is created. Values are joined
-        together using the operating system path separator (';' on Windows,
-        ':' elsewhere).
+        and otherwise a new environment variable is created.

-        Examples (assuming `EXAMPLE` does not exist initially):
-        | Append To Environment Variable | EXAMPLE    | first  |       |
-        | Should Be Equal                | %{EXAMPLE} | first  |       |
-        | Append To Environment Variable | EXAMPLE    | second | third |
- | Should Be Equal | %{EXAMPLE} | first${:}second${:}third |
+        Values are, by default, joined together using the operating system
+        path separator (';' on Windows, ':' elsewhere). This can be changed
+        by giving a separator after the values like `separator=value`. No
+        other configuration parameters are accepted.
+
+        Examples (assuming `NAME` and `NAME2` do not exist initially):
+        | Append To Environment Variable | NAME     | first  |       |
+        | Should Be Equal                | %{NAME}  | first  |       |
+        | Append To Environment Variable | NAME     | second | third |
+ | Should Be Equal | %{NAME} | first${:}second${:}third | + | Append To Environment Variable | NAME2 | first | separator=- | + | Should Be Equal | %{NAME2} | first | | + | Append To Environment Variable | NAME2 | second | separator=- | + | Should Be Equal | %{NAME2} | first-second |

         New in Robot Framework 2.8.4.
         """
@@ -946,7 +953,12 @@
         initial = self.get_environment_variable(name, sentinel)
         if initial is not sentinel:
             values = (initial,) + values
-        self.set_environment_variable(name, os.pathsep.join(values))
+        separator = config.pop('separator', os.pathsep)
+        if config:
+            config = ['='.join(i) for i in sorted(config.items())]
+            raise RuntimeError('Configuration %s not accepted.'
+                               % seq2str(config, lastsep=' or '))
+        self.set_environment_variable(name, separator.join(values))

     def remove_environment_variable(self, *names):
         """Deletes the specified environment variable.

==============================================================================
Revision: daf145a5348d
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Mon Jan 27 12:52:26 2014 UTC
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=daf145a5348d


--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to