go-check / check

Rich testing for the Go language
Other
696 stars 182 forks source link

check.Matches doesn't work with multi-line strings #94

Open ashb opened 7 years ago

ashb commented 7 years ago

For example I haven't found a way to make this work.

c.Check("one\ntwo", Matches, ".*two.*")

Because the matches must be a string, and that string is wrapped with ^ and $ we can't add our own flags either.

A possible quick fix is to check if the pattern is a regexp.Regexp, in which case don't compile the pattern ourselves.

barrettj12 commented 3 months ago

If you prefix your string with (?m), it should work.