Test::Unit::Assert(qr/pattern/,…) seems to fail on multiline strings

Recently had to change a number of lines from

$self->assert(qr/some_pattern/, $string, $message)

to

$self->assert($string =~ qr/some_pattern/m, $message)

Not sure why – the $string was a multi-line XML fragment, and the pattern was a phrase containing / and . chars. May need to do some more testing to isolate the reason. Works with the change. /m should not be necessary to match against a multiline string, but failed without this switch for my particular test cases.

Comments are closed.