3 new revisions:

Revision: 2836751c6232
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 13:48:13 2013 UTC
Log: Embedded Args: Validate that no positional args given before resolving...
http://code.google.com/p/robotframework/source/detail?r=2836751c6232

Revision: e0933c376e30
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 14:01:59 2013 UTC
Log:      Templates w/ embedded args: Test built kw names and args....
http://code.google.com/p/robotframework/source/detail?r=e0933c376e30

Revision: 67248fd9769e
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 14:02:15 2013 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=67248fd9769e

==============================================================================
Revision: 2836751c6232
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 13:48:13 2013 UTC
Log: Embedded Args: Validate that no positional args given before resolving embedded args.

Update issue 1454
Status: Started
Enhanced error message when given arg count doesn't match embedded arg count.
http://code.google.com/p/robotframework/source/detail?r=2836751c6232

Modified:
 /atest/robot/keywords/embedded_arguments.txt
 /atest/testdata/keywords/embedded_arguments.txt
 /atest/testdata/running/test_template_with_embeded_args.txt
 /src/robot/running/userkeyword.py

=======================================
--- /atest/robot/keywords/embedded_arguments.txt Mon Dec 19 21:33:30 2011 UTC +++ /atest/robot/keywords/embedded_arguments.txt Tue Nov 12 13:48:13 2013 UTC
@@ -10,6 +10,9 @@
Should Be Equal ${tc.kws[0].name} \${name}, \${book} = User Peke Selects Advanced Python From Webshop
     Check Log Message  ${tc.kws[2].kws[0].msgs[0]}  This is always executed
Should Be Equal ${tc.kws[2].name} \${name}, \${book} = User Juha Selects Playboy From Webshop
+
+Embedded And Positional Arguments Do Not Work Together
+    Check Test Case  ${TEST NAME}

 Complex Embedded Arguments
     ${tc} =  Check Test Case  ${TEST NAME}
@@ -28,6 +31,12 @@
 Non-Existing Variable in Embedded Arguments
     ${tc} =  Check Test Case  ${TEST NAME}
Should Be Equal ${tc.kws[0].name} User \${non existing} Selects \${variables} From Webshop
+
+Non-Existing Variable in Embedded Arguments and Positional Arguments
+    Check Test Case  ${TEST NAME}
+
+Non-Existing Variable in Embedded Arguments and in Positional Arguments
+    Check Test Case  ${TEST NAME}

 Custom Embedded Argument Regexp
     Check Test Case  ${TEST NAME}
=======================================
--- /atest/testdata/keywords/embedded_arguments.txt Mon Dec 19 21:33:30 2011 UTC +++ /atest/testdata/keywords/embedded_arguments.txt Tue Nov 12 13:48:13 2013 UTC
@@ -9,6 +9,11 @@
     ${name}  ${book} =  User Juha Selects Playboy From Webshop
     Should Be Equal  ${name}-${book}  Juha-Playboy

+Embedded And Positional Arguments Do Not Work Together
+ [Documentation] FAIL Keyword 'User \${user} Selects \${item} From Webshop' expected 0 arguments, got 1.
+    Given this "usage" with @{EMPTY} works  @{EMPTY}
+    Then User Invalid Selects Invalid From Webshop  invalid
+
 Complex Embedded Arguments
     Given this "feature" works
     When this "test case" is *executed*
@@ -31,6 +36,14 @@
 Non-Existing Variable in Embedded Arguments
     [Documentation]  FAIL Non-existing variable '${non existing}'.
     User ${non existing} Selects ${variables} From Webshop
+
+Non-Existing Variable in Embedded Arguments and Positional Arguments
+ [Documentation] FAIL Keyword 'User \${user} Selects \${item} From Webshop' expected 0 arguments, got 2. + User ${non existing} Selects ${variables} From Webshop invalid args
+
+Non-Existing Variable in Embedded Arguments and in Positional Arguments
+    [Documentation]  FAIL Non-existing variable '\${nonex pos}'.
+    User ${nonex emb} Selects ${variables} From Webshop    ${nonex pos}

 Custom Embedded Argument Regexp
[Documentation] FAIL No keyword with name 'Result of a + b is fail' found.
=======================================
--- /atest/testdata/running/test_template_with_embeded_args.txt Thu Nov 7 17:57:18 2013 UTC +++ /atest/testdata/running/test_template_with_embeded_args.txt Tue Nov 12 13:48:13 2013 UTC
@@ -31,12 +31,12 @@
     ${1} + ${2}    ${3}

 Cannot have more arguments than variables
-    [Documentation]    FAIL Non-existing variable '${calc}'.
+ [Documentation] FAIL Keyword 'The result of ${calculation} should be ${expected}' expected 0 arguments, got 2.
     [Template]    The result of ${calc} should be 3
     1 + 2    extra

 Cannot have less arguments than variables
-    [Documentation]    FAIL Non-existing variable '${calc}'.
+ [Documentation] FAIL Keyword 'The result of ${calculation} should be ${expected}' expected 0 arguments, got 1.
     [Template]    The result of ${calc} should be ${extra}
     1 + 2
     4 - 1
=======================================
--- /src/robot/running/userkeyword.py   Thu Nov  7 15:49:08 2013 UTC
+++ /src/robot/running/userkeyword.py   Tue Nov 12 13:48:13 2013 UTC
@@ -328,7 +328,8 @@

     def _run(self, context, args):
         if not context.dry_run:
+            variables = context.variables
+ self._resolve_arguments(args, variables) # validates no args given
             for name, value in self.embedded_args:
-                context.variables[name] = \
-                    context.variables.replace_scalar(value)
+                variables[name] = variables.replace_scalar(value)
         return UserKeywordHandler._run(self, context, args)

==============================================================================
Revision: e0933c376e30
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 14:01:59 2013 UTC
Log:      Templates w/ embedded args: Test built kw names and args.

Update issue 1454
Status: Done
Enhanced tests to verify how resulted keywords look in logs.

Jussi checked docs and considered them good enough. I consider this issue done.
http://code.google.com/p/robotframework/source/detail?r=e0933c376e30

Modified:
 /atest/robot/running/test_template_with_embeded_args.txt

=======================================
--- /atest/robot/running/test_template_with_embeded_args.txt Thu Nov 7 17:57:18 2013 UTC +++ /atest/robot/running/test_template_with_embeded_args.txt Tue Nov 12 14:01:59 2013 UTC
@@ -5,22 +5,44 @@

 *** Test Cases ***
 Matching arguments
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+    Keyword should be    ${tc.kws[0]}   The result of 1 + 1 should be 2
+    Keyword should be    ${tc.kws[1]}   The result of 1 + 2 should be 3
+    Keyword should be    ${tc.kws[2]}   The result of 1 + 3 should be 5

 Argument names do not need to be same as in definition
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+    Keyword should be    ${tc.kws[0]}   The result of 1 + 1 should be 2
+    Keyword should be    ${tc.kws[1]}   The result of 1 + 2 should be 3
+    Keyword should be    ${tc.kws[2]}   The result of 1 + 3 should be 5

 Some arguments can be hard-coded
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+    Keyword should be    ${tc.kws[0]}   The result of 1 + 1 should be 3
+    Keyword should be    ${tc.kws[1]}   The result of 1 + 2 should be 3
+    Keyword should be    ${tc.kws[2]}   The result of 1 + 3 should be 3

 Can have different arguments than definition
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Keyword should be ${tc.kws[0]} The result of 38 + 3 + 1 should be 42 + Keyword should be ${tc.kws[1]} The non-existing of 666 should be 42

 Can use variables
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Keyword should be ${tc.kws[0]} The result of \${1} + \${2} should be \${3}

 Cannot have more arguments than variables
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+    Keyword should be    ${tc.kws[0]}    The result of \${calc} should be 3
+    ...    1 + 2    extra

 Cannot have less arguments than variables
-    Check Test Case    ${TESTNAME}
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Keyword should be ${tc.kws[0]} The result of \${calc} should be \${extra}
+    ...    1 + 2
+
+*** Keywords ***
+Keyword should be
+    [Arguments]    ${kw}    ${name}    @{args}
+    Should Be Equal    ${kw.name}    ${name}
+    Lists Should Be Equal    ${kw.args}    ${args}

==============================================================================
Revision: 67248fd9769e
Branch:   default
Author:   Pekka Klärck
Date:     Tue Nov 12 14:02:15 2013 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=67248fd9769e


--

--- 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