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

offer a way to escape comma as prove plugin argument separator #126

Open
XSven opened this issue Jan 19, 2024 · 4 comments
Open

offer a way to escape comma as prove plugin argument separator #126

XSven opened this issue Jan 19, 2024 · 4 comments

Comments

@XSven
Copy link

XSven commented Jan 19, 2024

I want to develop a prove plugin that needs more flexibility with respect to the arguments passed to the plugin. Especially the comma should at some places be used as is. Currently there exists now way to escape it.

my @args = ();
if ( $name =~ /^(.*?)=(.*)/ ) {
  $name = $1;
  @args = split( /,/, $2 );
}

Do you see any way to implement this? A number of different approaches are described here split on delimiter unless escaped.

@Leont
Copy link
Member

Leont commented Jan 21, 2024

I agree with you this is not ideal, but I'm worried about breaking backwards compatibility. I know it's ugly but is it should work reliably.

@XSven
Copy link
Author

XSven commented Jan 21, 2024

I would have bet that breaking backwards compatibility would be the killer argument. Of course the way argument splitting is implemented works as long as the arguments do not contain a comma. I would like to pass a JSON one liner to a prove plugin to have flexible way to configure it. One such configuration could be

test_args => {
  my_test    => ['foo', 'bar'],
  other_test => ['baz'],
}

@Leont
Copy link
Member

Leont commented Jan 21, 2024

Join you just join on , to get your JSON back?

@XSven
Copy link
Author

XSven commented Jan 22, 2024

Sorry I do not get your question. This could be an example configuration in a .proverc configuration file

-PMyPlugin={"test_args":{"my_test":["foo","bar"],"other_test":["baz"]}}

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