Revision: 3408
Author: janne.t.harkonen
Date: Mon May 24 03:39:10 2010
Log: Fix for loop tests after errors and validation changed
http://code.google.com/p/robotframework/source/detail?r=3408

Modified:
 /trunk/atest/robot/core/for.txt
 /trunk/atest/testdata/core/for.txt

=======================================
--- /trunk/atest/robot/core/for.txt     Tue May 11 05:53:38 2010
+++ /trunk/atest/robot/core/for.txt     Mon May 24 03:39:10 2010
@@ -28,11 +28,14 @@

 Empty For
     ${test} =  Check Test Case  Empty for
-    Should Be For Keyword  ${test.kws[0]}  2
+    Should Be For Keyword  ${test.kws[0]}  0

 For Without Value
     ${test} =  Check Test Case  For Without value
     Should Be For Keyword  ${test.kws[0]}  0
+
+For Loop Over Empty List Var
+    Check Test Case  ${TESTNAME}

 For Failing
     ${test} =  Check Test Case  For Failing
@@ -128,21 +131,21 @@
Check Log Message ${test.kws[0].kws[1].kws[2].msgs[0]} \...@{list} = [ 1 | 2 | 3 | z ]

 For Without In
-    Check Syntax Error Test Case  For Without In 1
-    Check Syntax Error Test Case  For Without In 2
-    Check Syntax Error Test Case  For Without In 3
+    Check Test Case  For Without In 1
+    Check Test Case  For Without In 2
+    Check Test Case  For Without In 3

 For Without Parameters
-    Check Syntax Error Test Case  For Without Parameters
+    Check Test Case  For Without Parameters

 For Without Variable
-    Check Syntax Error Test Case  For without variable
+    Check Test Case  For without variable

 Variable Format
-    Check Syntax Error Test Case  Variable Format 1
-    Check Syntax Error Test Case  Variable Format 2
-    Check Syntax Error Test Case  Variable Format 3
-    Check Syntax Error Test Case  Variable Format 4
+    Check Test Case  Variable Format 1
+    Check Test Case  Variable Format 2
+    Check Test Case  Variable Format 3
+    Check Test Case  Variable Format 4

 For With Non Existing Keyword
     Check Test Case  For With Non Existing Keyword
@@ -171,7 +174,6 @@
 For With Wrong Number Of Parameters For Multiple Variables
${test} = Check Test Case For With Wrong number of parameters for multiple variables
     Should Be For Keyword  ${test.kws[1]}  0
- Check Log Message ${test.kws[1].msgs[0]} Number of FOR loop values should be multiple of variables. Got 3 variables ('\${a}', '\${b}' and '\${c}') but 5 values. FAIL

 Cut Long Variable Value In For Item Name
     ${test} =  Check Test Case  Cut Long Variable Value In For Item Name
@@ -226,7 +228,6 @@
 For In Range With Too Many Arguments
     ${test} =  Check Test Case  For In Range With Too Many Arguments
     Should Be For In Range Keyword  ${test.kws[0]}  0
- Check Log Message ${test.kws[0].msgs[0]} FOR IN RANGE expected 1-3 arguments, got 4 instead. FAIL

 For In Range With No Arguments
     Check Test Case  For In Range With No Arguments
@@ -259,12 +260,6 @@
     [Arguments]  ${kw}  ${name}
     Equals  ${kw.type}  foritem  Not FOR item
     Equals  ${kw.name}  ${name}
-
-Check Syntax Error Test Case
-    [Arguments]  ${name}
-    ${test} =  Check Test Case  ${name}
-    Check Log Message  ${test.kws[0].msgs[0]}  This is executed
- Check Log Message ${test.kws[1].msgs[0]} Syntax error: Invalid syntax in FOR loop. Expected format:\n | : FOR | \${var} | IN | item1 | item2 | FAIL

 Test "Simple For 2" Helper
     [Arguments]  ${kw}  ${num}
=======================================
--- /trunk/atest/testdata/core/for.txt  Tue May 11 05:53:38 2010
+++ /trunk/atest/testdata/core/for.txt  Mon May 24 03:39:10 2010
@@ -2,8 +2,10 @@

 *** Variables ***
 @{NUMS}  1  2  3  4  5
-...@{empty}
-${SYNTAX_ERROR} Syntax error: Invalid syntax in FOR loop. Expected format:\n | : FOR | \${var} | IN | item1 | item2 |
+...@{empty_list}
+${NO VALUES}  FAIL FOR loop has no loop values.
+${NO KEYWORDS}  FAIL FOR loop contains no keywords.
+${NO VARIABLES}  FAIL FOR loop has no loop variables.

 *** Test Cases ***
 Simple For
@@ -19,20 +21,19 @@
     \  No Operation

 Empty For
-    [Documentation]  FAIL End of test
+    [Documentation]  ${NO KEYWORDS}
     :FOR  ${var}  IN  one  two
-    Equals  ${var}  two
-    Fail  End of test
+    Fail  Should not executed

 For Without Value
-    [Documentation]  FAIL End of test
+    [Documentation]  ${NO VALUES}
     :FOR  ${var}  IN
     \  Fail  not executed
-    Fail if variable exists  $var
-    :FOR  ${var}  IN  @{EMPTY}
+
+For Loop Over Empty List Var
+    :FOR  ${var}  IN  @{EMPTY_LIST}
     \  Fail  not executed
     Fail if variable exists  $var
-    Fail  End of test

 For Failing
     [Documentation]  FAIL Here we fail!
@@ -119,55 +120,55 @@
     Fail Unless  @{list} == [1, 2, 3, 'z']

 For Without In 1
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  ${NO VALUES}
     Log  This is executed
     : FOR  ${var}
     \   Fail  Not Executed

 For Without In 2
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable '\...@{nums}'.
     Log  This is executed
     : FOR  ${var}  @{NUMS}
     \   Fail  Not Executed

 For Without In 3
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable 'one'.
     Log  This is executed
     : FOR  ${var}  one  two  three
     \   Fail  Not Executed

 For Without Parameters
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  ${NO VARIABLES}
     Log  This is executed
     : FOR
     \   Fail  Not Executed

 For Without Variable
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  ${NO VARIABLES}
     Log  This is executed
     : FOR  IN  one  two
     \   Fail  Not Executed

 Variable Format 1
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable 'var'.
     Log  This is executed
     : FOR  var  IN  one  two
     \   Fail  Not Executed

 Variable Format 2
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable '$var'.
     Log  This is executed
     : FOR  $var  IN  one  two
     \   Fail  Not Executed

 Variable Format 3
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable '@{var}'.
     Log  This is executed
     : FOR  @{var}  IN  one  two
     \   Fail  Not Executed

 Variable Format 4
-    [Documentation]  FAIL ${SYNTAX_ERROR}
+    [Documentation]  FAIL Invalid FOR loop variable 'notvar'.
     Log  This is executed
     : FOR  ${var}  ${var2}  notvar  IN  one  two  three
     \   Fail  Not Executed
@@ -183,7 +184,7 @@
     \  Log  ${nonexisting}

 For With Invalid Set
- [Documentation] FAIL Cannot assign return value of keyword 'BuiltIn.Set Variable' to variables '\${x}' and '\${y}': Expected list, got string instead + [Documentation] FAIL Cannot assign return value to variables: Expected list-like object, got string instead.
     :FOR  ${i}  IN  1  3
     \  ${x}  ${y} =  Set Variable  Only one value

@@ -198,7 +199,7 @@
     Equals  ${a}${b}${c}${d}${e}  12345

 For With Wrong Number Of Parameters For Multiple Variables
- [Documentation] FAIL Number of FOR loop values should be multiple of variables. Got 3 variables ('\${a}', '\${b}' and '\${c}') but 5 values. + [Documentation] FAIL Number of FOR loop values should be multiple of variables. Got 3 variables but 5 values.
     Log  This is executed
     :FOR  ${a}  ${b}  ${c}  IN  @{NUMS}
     \  Fail  Not executed
@@ -257,7 +258,7 @@
     \  Fail  Not executed

 For In Range With No Arguments
- [Documentation] FAIL FOR IN RANGE expected 1-3 arguments, got 0 instead.
+    [Documentation]  ${NO VALUES}
     :FOR  ${i}  IN RANGE
     \  Fail  Not executed

@@ -267,7 +268,7 @@
     \  Fail  Not executed

 For In Range With Wrong Number Of Variables
- [Documentation] FAIL Number of FOR loop values should be multiple of variables. Got 2 variables ('\${x}' and '\${y}') but 11 values. + [Documentation] FAIL Number of FOR loop values should be multiple of variables. Got 2 variables but 11 values.
     :FOR  ${x}  ${y}  IN RANGE  11
     \  Fail  Not executed

Reply via email to