shunit2 icon indicating copy to clipboard operation
shunit2 copied to clipboard

Regex (not)Contains & equals

Open rugk opened this issue 6 years ago • 6 comments

We now have an assertContains, but what I still miss is a RegEx-version of that, so I can (use case:) do assertContainsRegEx "$archiveList" "^prefix1_" or so and I get check for prefix/suffixes etc.

Also this needs to be flexible enough to check the input per line or globally (RegEx stuff, as usual).

Previously I've just used an assertTrue and a grep for that. This works great.

rugk avatar Nov 25 '18 09:11 rugk

Obviously, the same may be done for "equals".

rugk avatar Nov 25 '18 09:11 rugk

Shouldn't that just be assertMatches and assertNotMatches? Tests can put line start and line end markers into the regex to distinguish between contains, equals, startswith, and endswith.

rolweber avatar Nov 12 '19 07:11 rolweber

There is no assertMatches in the code currently, it's also not documented in the Readme.

rugk avatar Nov 12 '19 12:11 rugk

Of course not. But there's no assertContainsRegEx either. I merely suggested a different name.

rolweber avatar Nov 12 '19 13:11 rolweber

Yeah good name. Did misunderstood that…

rugk avatar Nov 12 '19 13:11 rugk

This would be cool

paololazzari avatar May 24 '23 09:05 paololazzari