fluffynuts / NUnit.StaticExpect

Provides a mechanism for a static import of NUnit Expect() syntax (deprecated: see https://github.com/fluffynuts/NExpect for the next generation)
BSD 2-Clause "Simplified" License
3 stars 2 forks source link

Extend special-casing to rewrite signature and continue original test. #3

Closed BobSammers closed 7 years ago

BobSammers commented 7 years ago

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 called RewriteSignature is also sought out and this new signature is used to continue the original processing of the test. If RewriteSignature 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:

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 or AH 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.

fluffynuts commented 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.