You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecate ignoring space after literal newline #3333
Such wrapping doesn't work with the plain text format, and in general there has never been real benefits from this syntax with the plain text syntax. Now that RF 3.2 won't be supporting HTML anymore (#3081), this strange feature can go as well. We cannot remove it right away, but we can deprecate it in RF 3.2 and remove later.
A problem with deprecation is that handling \n happens in such code where the location where the syntax has been used isn't known. We can easily emit a warning that this syntax is deprecated, but the message won't tell where the problem occurs. The message has a timestamp and comparing it to timestamps in the execution log is possible, but finding exact locations using this approach is likely to be slow.
An easier solution is simply finding \n usages from the test data. This can be done with an editor/IDE or an external tool like ack or pss. I used the latter with Robot's own tests using this command:
This deprecation will be included in RF 3.2 alpha 1. If it turns out \n syntax is used widely and finding usages is hard, we can still enhance the deprecation messages before RF 3.2 final. If there are valid use cases for this syntax, we can also consider removing the deprecation.
This quirk also has a quirk that space isn't ignored after \n when using the extended variable syntax. Inconsistency is not good, and an easy way to have consistent behavior it is removing the whole "feature".
I was able to enhance this a bit. Now the deprecation warning has a link to the keyword causing it if this syntax is used in keyword arguments. If it's used in e.g. in documentation, only the message is shown. Also added a reference to this issue to that message. Both changes will be committed shortly.
Hello @pekkaklarck,
After this change I can see that now breaking variables which consist of \n is problematic, as this:
${a}= Set Variable two lines\nhere
${b}= Set Variable two lines\n
... here
Should Be Equal ${a} ${b}
should PASS but it FAIL because 2 spaces as a separator between ... and next part of variable will be processed as 1 space as a part of variable so instead
Activity
pekkaklarck commentedon Oct 9, 2019
A problem with deprecation is that handling
\nhappens in such code where the location where the syntax has been used isn't known. We can easily emit a warning that this syntax is deprecated, but the message won't tell where the problem occurs. The message has a timestamp and comparing it to timestamps in the execution log is possible, but finding exact locations using this approach is likely to be slow.An easier solution is simply finding
\nusages from the test data. This can be done with an editor/IDE or an external tool like ack or pss. I used the latter with Robot's own tests using this command:pekkaklarck commentedon Oct 9, 2019
This deprecation will be included in RF 3.2 alpha 1. If it turns out
\nsyntax is used widely and finding usages is hard, we can still enhance the deprecation messages before RF 3.2 final. If there are valid use cases for this syntax, we can also consider removing the deprecation.pekkaklarck commentedon Oct 9, 2019
This quirk also has a quirk that space isn't ignored after
\nwhen using the extended variable syntax. Inconsistency is not good, and an easy way to have consistent behavior it is removing the whole "feature".Test data cleanup
[-]Deprecate ignoring space after literal newline (`\n `)[/-][+]Deprecate ignoring space after literal newline[/+]pekkaklarck commentedon Mar 3, 2020
I was able to enhance this a bit. Now the deprecation warning has a link to the keyword causing it if this syntax is used in keyword arguments. If it's used in e.g. in documentation, only the message is shown. Also added a reference to this issue to that message. Both changes will be committed shortly.
Enhance deprecation message of ignoring space after '\n'.
paperclip commentedon Jul 16, 2020
Sorry for commenting on a closed ticket.
What should be placed instead of the space, if the intent is for there to be a space required?
paperclip commentedon Jul 16, 2020
I guess maybe ${SPACE}?
pekkaklarck commentedon Jul 16, 2020
Yeah,
${SPACE}ought to work.Fix warning messages for ignoring space after newline
tomekPawlak commentedon Feb 1, 2021
Hello @pekkaklarck,
After this change I can see that now breaking variables which consist of \n is problematic, as this:
should PASS but it FAIL because 2 spaces as a separator between ... and next part of variable will be processed as 1 space as a part of variable so instead
we would have
Enhance deprecation message of ignoring space after '\n'.