Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b135d6a

Browse files
authored
Fix crash caused by empty user keyword arguments
Fixes #4181.
1 parent c49393d commit b135d6a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

atest/robot/parsing/user_keyword_settings.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ Small typo should provide recommendation
106106
... Non-existing setting 'Doc Umentation'. Did you mean:
107107
... ${SPACE*4}Documentation
108108

109+
Invalid empty line continuation in arguments should throw an error
110+
Error in File 3 parsing/user_keyword_settings.robot 206
111+
... Creating keyword 'Invalid empty line continuation in arguments should throw an error' failed: Invalid argument specification: Invalid argument syntax ''.
112+
113+
109114
*** Keywords ***
110115
Verify Documentation
111116
[Arguments] ${doc} ${test}=${TEST NAME}

atest/testdata/parsing/user_keyword_settings.robot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,7 @@ Invalid failing
202202
Small typo should provide recommendation
203203
[Doc Umentation]
204204
No Operation
205+
206+
Invalid empty line continuation in arguments should throw an error
207+
[Arguments]
208+
...

src/robot/running/arguments/argumentparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ def _validate_arg(self, arg):
196196
return arg, default
197197

198198
def _is_kwargs(self, arg):
199-
return arg[0] == '&'
199+
return arg and arg[0] == '&'
200200

201201
def _format_kwargs(self, kwargs):
202202
return kwargs[2:-1]
203203

204204
def _is_varargs(self, arg):
205-
return arg[0] == '@'
205+
return arg and arg[0] == '@'
206206

207207
def _is_kw_only_separator(self, arg):
208208
return arg == '@{}'

0 commit comments

Comments
 (0)