[mocha-developer] ParameterMatcher backwards compatibility broken

James Mead jamesmead44 at gmail.com
Thu Nov 15 13:05:34 EST 2007


I've just committed (revision 194) a first stab at supporting optional
parameter matching. More about this later, but in the meantime I
wanted to warn anyone bold enough to be working with "edge" Mocha,
that any custom parameter matchers they have written will be broken by
this change.

However it is easy enough to fix them. You need to derive the matcher
from ParameterMatcher::Base and you need to change the "==" method to
"matches?". This method is now supplied with an array of the remaining
parameters to match and you are expected to "consume" any parameters
that you match.

It's probably easiest to see in an example [1] which includes both old
and new versions. And here [2] is a diff file for the same class.

Please let me know if I've broken anything.

Thanks.
-- 
James.
http://blog.floehopper.org
http://tumble.floehopper.org

[1] http://pastie.caboo.se/118417
[2] http://pastie.caboo.se/118419


More information about the mocha-developer mailing list