Closed BobSammers closed 7 years ago
I don't think you're overthinking this. I'm still a little on the fence for requiring perfect sig-for-sig compatibility when behavioral compatibility is known, but I do see the value of the tests and striving for perfect compat. Thanks for the hard work.
This PR modifies the special case processing to rewrite the signature to be what we expect in each of the two special cases. If a matching signature (which now has to be named
OriginalSignature
) is found in a special case type, another calledRewriteSignature
is also sought out and this new signature is used to continue the original processing of the test. IfRewriteSignature
isn't found,Fail()
is called. Once the test completes,Ignore()
is called anyway. It's slightly more convoluted than I'd like, but it's also temporary - see below.My rationale for this is:
TestAssertionHelperCompatibility
was for a single purpose: to prove that each of the members (including overloads) ofAssertionHelper
was replicated sig for sig. We can now (almost) claim that again: all members ofAH
must have a corresponding member inSE
where the signature is "expected" (if not "identical") or the test will fail.Fail()
andIgnore()
choices: special cases are about incorrect signatures, but we still expect them to be incorrect in a particular way (i.e. we know what they will be). If anything deviates from this - which might be because of a change toAH
orSE
- it's a test fail, if it's "wrong" in the way we expect, it's an ignore (it's still not right, after all).AH
behaviour with the underlying members thatSE
takes its functionality from. At this point, the special casing will be unnecessary and these tests will start to fail, highlighting that the special cases (and calls toIgnore()
) should be removed (the behavioural tests can remain, of course).I get that the behavioural tests do prove that the special cases behave in the same way as the originals, but they don't quite prove the signatures match - any return or parameter type changes in
SE
orAH
won't necessarily be picked up if, for example, new types allow for an implicit conversion. (More specifically, if I've made a hash of the PR to NUnit, the prompt to remove - and subsequent removal of - the special cases here will highlight that!)It's not inconceivable that I'm over thinking this. A sig <-> sig match may be effectively pointless, but it seems to me to be the ideal for the type of project this is (i.e. one that is supposed to replicate existing behaviour as far as possible). In that vein, ensuring the tests give information so we stay on top of how and where divergence occurs seems to have value.