Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robot: accept regex in embedded arguments #1572

Closed
mMontu opened this issue Oct 6, 2017 · 2 comments
Closed

Robot: accept regex in embedded arguments #1572

mMontu opened this issue Oct 6, 2017 · 2 comments

Comments

@mMontu
Copy link
Contributor

mMontu commented Oct 6, 2017

@masatake: While I was testing the solution from #1570 against a large project (with a tags file with ~51k lines) I noticed that keywords with embedded arguments using regex (thus containing : and possible | and other regex elements) have incomplete tags.

I tried I to implement a possible solution (which I'm going to commit against your branch for the previous issue), and in the process I increased the test file:

*** Variables ***

${myvar}    variable_value

*** Keywords ***

My Regular Keyword
    Sleep  5s

${embedded arg} Starting Single
    No Operation

${e} Starting Single Letter
    No Operation


${embedded arg:value1|value2} Starting Single With Regex
    No Operation

${embedded arg1} Starting ${embedded arg2} Multiple
    No Operation

${embedded arg1} Starting ${embedded arg2:value1|value2} Multiple With Regex
    No Operation

${embedded arg1} Starting And ${embedded arg2} Ending ${embedded arg3}
    No Operation

Middle ${embedded arg} Single Arguments
    No Operation

Middle ${embedded arg1} Multiple ${embedded arg2} Arguments
    No Operation

Middle ${embedded arg:value1|value2} Single Arguments With Regex
    No Operation

Middle ${e} Single Letter Arguments
    No Operation

Ending Single ${embedded arg}
    No Operation

Ending Multiple ${embedded arg1} And ${embedded arg2}
    No Operation

My Keyword_with_underscore-and-dashes
    No Operation

My Keyword_With $ dollar sign
    No Operation

*** Test Cases ***

My Test With Template1        My Kw 1        My Kw 2

This is the output with the possible fix:

  !_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
  !_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
  !_TAG_OUTPUT_MODE	u-ctags	/u-ctags or e-ctags/
  !_TAG_PROGRAM_AUTHOR	Universal Ctags Team	//
  !_TAG_PROGRAM_NAME	Universal Ctags	/Derived from Exuberant Ctags/
  !_TAG_PROGRAM_URL	https://ctags.io/	/official site/
  !_TAG_PROGRAM_VERSION	0.0.0	/2a20e13/
  ${embedded arg1} Starting ${embedded arg2:value1|value2} Multiple With Regex	temp3.robot	/^${embedded arg1} Starting ${embedded arg2:value1|value2} Multiple With Regex$/;"	k
  ${embedded arg1} Starting ${embedded arg2} Multiple	temp3.robot	/^${embedded arg1} Starting ${embedded arg2} Multiple$/;"	k
  ${embedded arg1} Starting And ${embedded arg2} Ending ${embedded arg3}	temp3.robot	/^${embedded arg1} Starting And ${embedded arg2} Ending ${embedded arg3}$/;"	k
  ${embedded arg:value1|value2} Starting Single With Regex	temp3.robot	/^${embedded arg:value1|value2} Starting Single With Regex$/;"	k
  ${embedded arg} Starting Single	temp3.robot	/^${embedded arg} Starting Single$/;"	k
  ${embedded_arg1}_Starting_${embedded_arg2:value1|value2}_Multiple_With_Regex	temp3.robot	/^${embedded arg1} Starting ${embedded arg2:value1|value2} Multiple With Regex$/;"	k
  ${embedded_arg1}_Starting_${embedded_arg2}_Multiple	temp3.robot	/^${embedded arg1} Starting ${embedded arg2} Multiple$/;"	k
  ${embedded_arg1}_Starting_And_${embedded_arg2}_Ending_${embedded_arg3}	temp3.robot	/^${embedded arg1} Starting And ${embedded arg2} Ending ${embedded arg3}$/;"	k
  ${embedded_arg:value1|value2}_Starting_Single_With_Regex	temp3.robot	/^${embedded arg:value1|value2} Starting Single With Regex$/;"	k
  ${embedded_arg}_Starting_Single	temp3.robot	/^${embedded arg} Starting Single$/;"	k
  ${e} Starting Single Letter	temp3.robot	/^${e} Starting Single Letter$/;"	k
  ${e}_Starting_Single_Letter	temp3.robot	/^${e} Starting Single Letter$/;"	k
  Ending Multiple ${embedded arg1} And ${embedded arg2}	temp3.robot	/^Ending Multiple ${embedded arg1} And ${embedded arg2}$/;"	k
  Ending Single ${embedded arg}	temp3.robot	/^Ending Single ${embedded arg}$/;"	k
  Ending_Multiple_${embedded_arg1}_And_${embedded_arg2}	temp3.robot	/^Ending Multiple ${embedded arg1} And ${embedded arg2}$/;"	k
  Ending_Single_${embedded_arg}	temp3.robot	/^Ending Single ${embedded arg}$/;"	k
  Middle ${embedded arg1} Multiple ${embedded arg2} Arguments	temp3.robot	/^Middle ${embedded arg1} Multiple ${embedded arg2} Arguments$/;"	k
  Middle ${embedded arg:value1|value2} Single Arguments With Regex	temp3.robot	/^Middle ${embedded arg:value1|value2} Single Arguments With Regex$/;"	k
  Middle ${embedded arg} Single Arguments	temp3.robot	/^Middle ${embedded arg} Single Arguments$/;"	k
  Middle ${e} Single Letter Arguments	temp3.robot	/^Middle ${e} Single Letter Arguments$/;"	k
  Middle_${embedded_arg1}_Multiple_${embedded_arg2}_Arguments	temp3.robot	/^Middle ${embedded arg1} Multiple ${embedded arg2} Arguments$/;"	k
  Middle_${embedded_arg:value1|value2}_Single_Arguments_With_Regex	temp3.robot	/^Middle ${embedded arg:value1|value2} Single Arguments With Regex$/;"	k
  Middle_${embedded_arg}_Single_Arguments	temp3.robot	/^Middle ${embedded arg} Single Arguments$/;"	k
  Middle_${e}_Single_Letter_Arguments	temp3.robot	/^Middle ${e} Single Letter Arguments$/;"	k
  My Keyword With $ dollar sign	temp3.robot	/^My Keyword_With $ dollar sign$/;"	k
  My Keyword with underscore-and-dashes	temp3.robot	/^My Keyword_with_underscore-and-dashes$/;"	k
  My Keyword_With $ dollar sign	temp3.robot	/^My Keyword_With $ dollar sign$/;"	k
  My Keyword_with_underscore-and-dashes	temp3.robot	/^My Keyword_with_underscore-and-dashes$/;"	k
  My Regular Keyword	temp3.robot	/^My Regular Keyword$/;"	k
  My Test With Template1	temp3.robot	/^My Test With Template1        My Kw 1        My Kw 2$/;"	t
  My_Regular_Keyword	temp3.robot	/^My Regular Keyword$/;"	k
  My_Test_With_Template1	temp3.robot	/^My Test With Template1        My Kw 1        My Kw 2$/;"	t
  myvar	temp3.robot	/^${myvar}    variable_value$/;"	v

Thanks in advance

@masatake
Copy link
Member

masatake commented Oct 6, 2017

Thank you. I merged your PR to my repo (with rebasing). Then I update the test case based on the comment you wrote here.

@mMontu
Copy link
Contributor Author

mMontu commented Oct 6, 2017

Thank you for answering so fast and providing fixes for this great tool!

@mMontu mMontu closed this as completed Oct 6, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants