Open jimni opened 8 years ago
I can see this growing quickly beyond my knowledge.
${var1 + 1}
, sure as you point out
${1 + var1}
?
${var1 + var2}
?
Is there a general rule? or everything inside the ${} split by spaces is fair game at some kind of declaration?
Here goes the documentation for this case: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#extended-variable-syntax
If it was up to me I would use something like
/keyword([ ]?(\+|\-|\*|\/)[ ]?(([\d]+\.?[\d]*)|(\.[\d]+))[ ]?)*/
Elucidation being here.
I have to mention, that strings with .method() work fine already:
${var_3}= Convert To String ${var_1.__abs__()}
I reckon plugin thinks its a case of extended assignment (next chapter in the same doc). I can't think of when this might be a bad thing, but I'm not that good with RF either.
Here are also some examples of appropriate syntax:
${var_2}= Set Variable ${var_1 +.1}
${var_2}= Set Variable ${var_1 +1.}
${var_2}= Set Variable ${var_1 +1.1}
${var_2}= Set Variable ${var_1+1}
${var_2}= Set Variable ${var_1 + 1}
${var_2}= Set Variable ${var_1 + 1 } # trailing space
${var_2}= Set Variable ${var_1 + 1 - 1 / 1 * 1}
${var_2}= Set Variable ${var_1.method()}
${var_2}= Set Variable ${var_1.method() } # trailing space
${var_2}= Set Variable ${var_1.method() + 1}
${var_2}= Set Variable ${var_1.method(arg1, arg2)}
${var_2}= Set Variable ${var_1.method1().method2()}
And some bad uses (will cause error):
${var_2}= Set Variable ${var_1 +.}
${var_2}= Set Variable ${var_1 +}
${var_2}= Set Variable ${var_1 + } # trailing space
${var_2}= Set Variable ${var_1 + var_3}
${var_2}= Set Variable ${1 + var_1}
${var_2}= Set Variable ${method(var_1)}
There is also a case of immediate trailing space after var, which will not cause any error:
${var_2}= Set Variable ${var_1 } # trailing space
but I don't this it's worth adding to the plugin due to its utter uselessness.
I am using Pycharm CE + plugin v.0.6.7.
I would like the proofing tool to correctly parse mathematical operations inside curly braces of a variable, e.g.:
Now results in: