LukeANewton/Tool-Framework-to-Measure-Test-Case-Diversity

specify whether the delimiter is a regex or not

Opened this issue · 0 comments

There are some issues with specifying the delimiter in a compare command due to how String.split() works. split() always expects a regex, so any delimiter with a metacharacter that is treated as so.

For example, if I wanted to delimit my test cases with "*****" the user would need to type "*****" into the terminal, otherwise you would get an error. That is manageable, but it would be nice if you could explicitly choose whether or not your delimiter should be treated as a regex or literal.

We can use Pattern.quote(string) to force a string to be a literal for string.split(), but we require some way for the user to say whether they have a regex or literal delimiter. maybe use "-d" for literal delimiter, and "-rd" for regex delimiter? you could store the delimiter as normal in the DTO and add a field to specify whether the delimiter string is a regex or literal.