This is rather more detail than the average user will need. Test::Unit::Assertion::Regexp objects are generated automagically by Test::Unit::Assert::assert when it is passed a regular expression as its first parameter.

sub test_foo {
...
$self->assert(qr/some_pattern/, $result);
}

If the assertion fails then the object throws an exception with details of the pattern and the string it failed to match against.

Note that if you need to do a 'string does not match this pattern' type of assertion then you can do: