Skip to content

Commit

Permalink
Merge pull request #39 from melexis/special-characters
Browse files Browse the repository at this point in the history
Support special characters in test case names
  • Loading branch information
Letme authored May 23, 2023
2 parents e25cbb1 + 5c4ffa5 commit 92bd537
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ROBOT2RST = robot2rst
ROBOT2RST_OPTS += -i $(SOURCEDIR)/robot/example.robot
ROBOT2RST_OPTS += -o $(SOURCEDIR)/example_usage_qtp.rst
ROBOT2RST_OPTS += -t ^SWRQT- ^SYSRQT-
ROBOT2RST_OPTS += -c 100 50.0
ROBOT2RST_OPTS += -c 100 40.0
ROBOT2RST_OPTS += -r validates ext_toolname
ROBOT2RST_OPTS += --only FLASH

Expand Down
4 changes: 4 additions & 0 deletions doc/source/robot/example.robot
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Another Test
FOR ${var} IN @{NAMES}
Log ${var}

Comp1: testing 'Special" characters & prefix (with brackets)
[Documentation] The item ID will contain COMP1-TESTING_SPECIAL_CHARACTERS_AND_PREFIX_WITH_BRACKETS.
Log Special characters in test case names are supported but not recommended.

*** Keywords ***
My Keyword
[Documentation] My keyword's documentation string.
Expand Down
6 changes: 5 additions & 1 deletion mlx/robot2rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ def to_traceable_item(name, prefix=''):
name = prefix + name
# Move to capitals
name = name.upper()
# Move ' : ' (or alike) to '-'
# Replace ' : ' (or alike) by '-'
name = re.sub('\s*:\s*', '-', name)
# Replace '&' by 'AND'
name = name.replace('&', 'AND')
# Remove other special characters
name = re.sub('[^\w\s_-]', '', name)
# Replace spaces with single underscore
name = re.sub('\s+', '_', name)
return name
Expand Down

0 comments on commit 92bd537

Please sign in to comment.