Skip to content

Document escaping rules for \ in {string}Β #357

@mpkorstanje

Description

@mpkorstanje

πŸ‘“ What did you see?

When using a Cucumber expression the implementation details of that expression leak into the message representation. Each capturing group in the tree-regexp a group is created as seen in cucumber/compatibility-kit#175.

With the exception of {string} the built in parameter only capture a single string and transform that. So the additional groups do not add any useful detail.

βœ… What did you expect to see?

Removing the unused capturing groups would make the output more concise

Note: For {string} the transformation looks like:

                String arg = args[0] != null ? args[0] : args[1];
                return (String) internalParameterTransformer.transform(arg
                                .replaceAll("\\\\\"", "\"")
                                .replaceAll("\\\\'", "'"),
                        String.class);

But that should probably be

                String arg = args[0] != null ? args[0].replaceAll("\\\\\"", "\"")
 : args[1].replaceAll("\\\\'", "'");
                return (String) internalParameterTransformer.transform(arg,
                        String.class);

πŸ“¦ Which tool/library version are you using?

No response

πŸ”¬ How could we reproduce it?

No response

πŸ“š Any additional context?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions