Skip to content

Commit bd192d8

Browse files
committed
Clarify documentation
This documentation was added as part of #5396.
1 parent 6ad86f5 commit bd192d8

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

doc/userguide/src/CreatingTestData/CreatingUserKeywords.rst

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -834,18 +834,14 @@ Using variables with custom embedded argument regular expressions
834834
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
835835

836836
When using embedded arguments with custom regular expressions, specifying
837-
values using values has certain limitations. Variables work fine if
838-
they match the whole embedded argument, but not if the value contains
839-
a variable with any additional content. For example, the first test below
840-
succeeds because the variable `${DATE}` matches the argument `${date}` fully,
841-
but the second test fails because `${YEAR}-${MONTH}-${DAY}` is not a single
842-
variable.
837+
values using variables works only if variables match the whole embedded
838+
argument, not if there is any additional content with the variable.
839+
For example, the first test below succeeds because the variable `${DATE}`
840+
is used on its own, but the last test fails because `${YEAR}-${MONTH}-${DAY}`
841+
is not a single variable.
843842

844843
.. sourcecode:: robotframework
845844

846-
*** Settings ***
847-
Library DateTime
848-
849845
*** Variables ***
850846
${DATE} 2011-06-27
851847
${YEAR} 2011
@@ -856,17 +852,15 @@ variable.
856852
Succeeds
857853
Deadline is ${DATE}
858854

855+
Succeeds without variables
856+
Deadline is 2011-06-27
857+
859858
Fails
860859
Deadline is ${YEAR}-${MONTH}-${DAY}
861860

862861
*** Keywords ***
863-
Deadline is ${date:(\d{4}-\d{2}-\d{2}|today)}
864-
IF '${date}' == 'today'
865-
${date} = Get Current Date
866-
ELSE
867-
${date} = Convert Date ${date}
868-
END
869-
Log Deadline is on ${date}.
862+
Deadline is ${date:\d{4}-\d{2}-\d{2}}
863+
Log Deadline is ${date}
870864

871865
Another limitation of using variables is that their actual values are not matched
872866
against custom regular expressions. As the result keywords may be called with

0 commit comments

Comments
 (0)