Revision: b62ebc86c526
Branch:   default
Author:   Pekka Klärck
Date:     Tue Oct 15 11:46:40 2013 UTC
Log:      More argument validation tests for --dryrun

Update issue 1511
The fix for this issue turned out to fix argument validation w/ dryrun in general. Added tests to prove it.
http://code.google.com/p/robotframework/source/detail?r=b62ebc86c526

Added:
 /atest/robot/cli/dryrun/args.txt
 /atest/testdata/cli/dryrun/args.txt
Modified:
 /atest/robot/cli/dryrun/dryrun.txt
 /atest/robot/cli/dryrun/kwargs.txt
 /atest/testdata/cli/dryrun/Library.py
 /atest/testdata/cli/dryrun/dryrun.txt
 /atest/testdata/cli/dryrun/kwargs.txt

=======================================
--- /dev/null
+++ /atest/robot/cli/dryrun/args.txt    Tue Oct 15 11:46:40 2013 UTC
@@ -0,0 +1,23 @@
+*** Settings ***
+Suite Setup      Run Tests    --dryrun    cli/dryrun/args.txt
+Force Tags       regression    pybot    jybot
+Resource         atest_resource.txt
+
+*** Test Cases ***
+Valid positional args
+    Check Test Case    ${TESTNAME}
+
+Too few arguments
+    Check Test Case    ${TESTNAME}
+
+Too few arguments for UK
+    Check Test Case    ${TESTNAME}
+
+Too many arguments
+    Check Test Case    ${TESTNAME}
+
+Valid named args
+    Check Test Case    ${TESTNAME}
+
+Invalid named args
+    Check Test Case    ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/testdata/cli/dryrun/args.txt Tue Oct 15 11:46:40 2013 UTC
@@ -0,0 +1,50 @@
+*** Settings ***
+Library     Library.py
+Resource    resource.txt
+
+*** Test Cases ***
+Valid positional args
+    Normal args    1
+    Normal args    1    2
+    Normal and varargs    1    2    3    4
+    Normal and varargs and kwargs   1    2    3    4
+
+Too few arguments
+ [Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 4 arguments, got 1.
+    Should Be Equal    1
+
+Too few arguments for UK
+ [Documentation] FAIL Keyword 'resource.Anarchy in the UK' expected 3 arguments, got 1.
+    Anarchy in the UK    foo
+
+Too many arguments
+ [Documentation] FAIL Keyword 'BuiltIn.No Operation' expected 0 arguments, got 2.
+    No Operation    ${foo}    bar
+
+Valid named args
+    Normal args    1      b=2
+    Normal args    a=1
+    Normal args    a=1    b=2
+    Normal args    b=2    a=1
+    Normal and varargs    1      b=2
+    Normal and varargs    a=1
+    Normal and varargs    a=1    b=2
+    Normal and varargs    b=2    a=1
+    Normal and varargs and kwargs    1      b=2
+    Normal and varargs and kwargs    a=1
+    Normal and varargs and kwargs    a=1    c=3
+    Normal and varargs and kwargs    a=1    b=2    c=3
+    Normal and varargs and kwargs    d=4    c=3    b=2    a=1
+
+Invalid named args
+    [Documentation]  FAIL Several failures occurred:\n\n
+ ... 1) Keyword 'Library.Normal Args' got positional argument after named arguments.\n\n + ... 2) Keyword 'Library.Normal Args' got positional argument after named arguments.\n\n + ... 3) Keyword 'Library.Normal Args' got positional argument after named arguments.\n\n + ... 4) Keyword 'Library.Normal And Varargs' got positional argument after named arguments.\n\n + ... 5) Keyword 'Library.Normal And Varargs And Kwargs' got positional argument after named arguments.
+    Normal args    a=1    c=3
+    Normal args    a=1    2
+    Normal args    a=1    b=2    c=3
+    Normal and varargs    a=1    b=2    c=3
+    Normal and varargs and kwargs    a=1    c=3    xxx
=======================================
--- /atest/robot/cli/dryrun/dryrun.txt  Tue May 28 13:28:33 2013 UTC
+++ /atest/robot/cli/dryrun/dryrun.txt  Tue Oct 15 11:46:40 2013 UTC
@@ -72,15 +72,6 @@

 Non-existing keyword name
     Check Test Case  ${TESTNAME}
-
-Too few arguments
-    Check Test Case  ${TESTNAME}
-
-Too few arguments for UK
-    Check Test Case  ${TESTNAME}
-
-Too many arguments
-    Check Test Case  ${TESTNAME}

 Invalid syntax in UK
     Check Test Case  ${TESTNAME}
=======================================
--- /atest/robot/cli/dryrun/kwargs.txt  Thu Sep 12 13:22:29 2013 UTC
+++ /atest/robot/cli/dryrun/kwargs.txt  Tue Oct 15 11:46:40 2013 UTC
@@ -4,7 +4,7 @@
 Resource         atest_resource.txt

 *** Test Cases ***
-Positional and kwargs
+Normal and kwargs
     Check Test Case    ${TESTNAME}

 Varargs and kwargs
=======================================
--- /atest/testdata/cli/dryrun/Library.py       Thu Sep 12 13:22:29 2013 UTC
+++ /atest/testdata/cli/dryrun/Library.py       Tue Oct 15 11:46:40 2013 UTC
@@ -1,4 +1,16 @@
-def positional_and_kwargs(positional, **kwargs):
+def normal_args(a, b=None):
+    pass
+
+
+def normal_and_varargs(a, b=None, *varargs):
+    pass
+
+
+def normal_and_varargs_and_kwargs(a, b=None, *varargs, **kwargs):
+    pass
+
+
+def normal_and_kwargs(positional, **kwargs):
     pass


=======================================
--- /atest/testdata/cli/dryrun/dryrun.txt       Mon May  6 23:11:48 2013 UTC
+++ /atest/testdata/cli/dryrun/dryrun.txt       Tue Oct 15 11:46:40 2013 UTC
@@ -74,18 +74,6 @@
     [Documentation]  FAIL No keyword with name 'Does not exist' found.
     Does not exist

-Too few arguments
- [Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 4 arguments, got 1.
-    Should Be Equal  1
-
-Too few arguments for UK
- [Documentation] FAIL Keyword 'resource.Anarchy in the UK' expected 3 arguments, got 1.
-    Anarchy in the UK  foo
-
-Too many arguments
- [Documentation] FAIL Keyword 'BuiltIn.No Operation' expected 0 arguments, got 2.
-    No Operation  ${foo}  bar
-
 Invalid syntax in UK
     [Documentation]  FAIL No keyword with name 'Invalid Syntax UK' found.
     Invalid Syntax UK
=======================================
--- /atest/testdata/cli/dryrun/kwargs.txt       Thu Sep 12 13:22:29 2013 UTC
+++ /atest/testdata/cli/dryrun/kwargs.txt       Tue Oct 15 11:46:40 2013 UTC
@@ -2,11 +2,11 @@
 Library    Library.py

 *** Test Cases ***
-Positional and kwargs
- [Documentation] FAIL Keyword 'Library.Positional And Kwargs' expected 1 non-keyword argument, got 0.
-    Positional and kwargs    arg
-    Positional and kwargs    arg    a=1    b=2
-    Positional and kwargs    a=1
+Normal and kwargs
+ [Documentation] FAIL Keyword 'Library.Normal And Kwargs' expected 1 non-keyword argument, got 0.
+    Normal and kwargs    arg
+    Normal and kwargs    arg    a=1    b=2
+    Normal and kwargs    a=1

 Varargs and kwargs
     Varargs and kwargs

--

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