SwensenSoftware / unquote

Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
http://www.swensensoftware.com/unquote
Apache License 2.0
285 stars 26 forks source link

Add support for evaluating private F# unions & records #122

Closed eiriktsarpalis closed 8 years ago

eiriktsarpalis commented 8 years ago

Not sure whether by design, but currently unquote seems to be failing when evaluating private F# unions & records. This PR attempts to address the issue.

stephen-swensen commented 8 years ago

@eiriktsarpalis thank you very much for this pull request, the unit tests are especially appreciated.

I think this is a compelling enhancement: Unquote should be able to execute most any code which can be legitimately captured in a quotation - in this case private types used in test assertions.

Question: did you spend any time investigating whether Unquote is already able to evaluate other kinds of private types (e.g. regular classes, etc.)? Once we open up private type evaluation, we should be consistent all the way. I'll do some thorough probing of my own, but just wanted to get an idea of how deep you dug.

Thanks again!!

eiriktsarpalis commented 8 years ago

That's a good question. Specifying binding flags is a requirement of the FSharp.Reflection module which must extract any needed MemberInfo from record/unions types. As far as other types are concerned, quotation trees already encapsulate the required MemberInfo's, so no binding flags need to be specified On Sat, 12 Mar 2016 at 14:39, Stephen Swensen notifications@github.com wrote:

@eiriktsarpalis https://github.com/eiriktsarpalis thank you very much for this pull request, the unit tests are especially appreciated.

I think this is a compelling enhancement: Unquote should be able to execute most any code which can be legitimately captured in a quotation - in this case private types used in test assertions.

Question: did you spend any time investigating whether Unquote is already able to evaluate other kinds of private types and such (e.g. regular classes, etc.)? Once we open up private type evaluation, we should be consistent all the way. I'll do some thorough probing of my own, but just wanted to get an idea of how deep you dug.

Thanks again!!

— Reply to this email directly or view it on GitHub https://github.com/SwensenSoftware/unquote/pull/122#issuecomment-195731077 .

eiriktsarpalis commented 8 years ago

@stephen-swensen I've added a few tests that check private class members too; they work as expected.

stephen-swensen commented 8 years ago

Got it - all looks good, merged into master branch - thanks!

eiriktsarpalis commented 7 years ago

@stephen-swensen any plans on pushing an update soon?

stephen-swensen commented 7 years ago

Hi @eiriktsarpalis - yes, sorry, 'been a busy few weeks for me. I'll try to get a release out in the next week or so.

Not ideal, but CI build available at https://ci.appveyor.com/project/stephen-swensen/unquote/build/artifacts in the meantime.

stephen-swensen commented 7 years ago

@eiriktsarpalis boy time flies... this is released on NuGet now! Thanks for patience.

eiriktsarpalis commented 7 years ago

Awesome, thanks! On Sat, 6 Aug 2016 at 09:10, Stephen Swensen notifications@github.com wrote:

@eiriktsarpalis https://github.com/eiriktsarpalis boy time flies... this is released on NuGet now! Thanks for patience.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SwensenSoftware/unquote/pull/122#issuecomment-238008209, or mute the thread https://github.com/notifications/unsubscribe-auth/ACrts79UavntyB77AREWbdKprJcaBXWcks5qdCVJgaJpZM4HfhFK .