Revision: 0e86e6c25656
Branch:   default
Author:   Mikko Korpela <[email protected]>
Date:     Tue Mar 12 06:00:13 2013
Log:      Tests for scalar to list var conversion
http://code.google.com/p/robotframework/source/detail?r=0e86e6c25656

Added:
 /atest/robot/core/list_and_scalar_variables.robot
 /atest/testdata/core/list_and_scalar_variables.robot
Modified:
 /src/robot/variables/variables.py

=======================================
--- /dev/null
+++ /atest/robot/core/list_and_scalar_variables.robot Tue Mar 12 06:00:13 2013
@@ -0,0 +1,16 @@
+*** Settings ***
+Suite Setup     Run Tests  \  core/list_and_scalar_variables.robot
+Force Tags      regression  jybot  pybot
+Resource        atest_resource.txt
+
+*** Test Cases ***
+
+List variable as a scalar variable
+  Check testcase  status=PASS
+
+Scalar variable as a list variable
+  Check testcase  status=PASS
+
+Scalar variable that can not be a list variable
+  Check testcase  status=FAIL  message=Non-existing variable '\@{scalar}'.
+
=======================================
--- /dev/null
+++ /atest/testdata/core/list_and_scalar_variables.robot Tue Mar 12 06:00:13 2013
@@ -0,0 +1,15 @@
+*** Test Cases ***
+List variable as a scalar variable
+  @{listvar}=  Set Variable  1  2  3
+  Log  ${listvar}
+
+Scalar variable as a list variable
+  ${scalar}=   Evaluate  [1,2,3]
+  :FOR  ${i}  IN   @{scalar}
+  \     Log   ${i}
+
+Scalar variable that can not be a list variable
+  ${scalar}=   Set Variable  1
+  :FOR  ${i}  IN   @{scalar}
+  \     Log   ${i}
+
=======================================
--- /src/robot/variables/variables.py   Tue Mar 12 05:40:41 2013
+++ /src/robot/variables/variables.py   Tue Mar 12 06:00:13 2013
@@ -100,6 +100,8 @@
             try:
value = utils.NormalizedDict.__getitem__(self, '$'+name[1:])
                 iter(value)
+                if isinstance(value, basestring):
+                    raise ValueError
                 return value
             except KeyError, TypeError:
                 pass

--

--- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to