-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluent matchers extension #454
Comments
Hey @cdibbs. Thanks for raising this looks like some interesting thoughts. What I'd like to know is how you envisage this differing from the From what I can see so far:
Are there any other differences or additions you'd propose? |
@jamesrichford - Yep, that pretty close to sums it up.
To exemplify the second one, I had roughly this thought: Expect(sthg)
.with(s => s.Prop).matches(/asdf/).and /* keeps context */.not.matches(/fdsa/)
.with(/* drops context*/ s => s.Prop2).etc. but ended up going the |
@jamesrichford - How do you feel about having a second |
@jamesrichford A note on the PR - in the jsdoc comments on 2-3 methods I dropped some git.io shortened links to wiki pages on my fork (writing them helped me flesh out my ideas). In the long run, I thought it might be nice to point those to the official wiki. |
Per discussions and discoveries on the PR (#459), we've decided this should be in its own library. |
@jamesrichford, @Jameskmonger FYI I've released an alpha of the plugin called I am reasonably confident there are no major bugs, but I'll continue using it in my own stuff for awhile before releasing a public beta. |
I began to think about this idea in the comments on another issue, but will finish it, here. Essentially, when using Alsatian's current Expect/matchers framework, I felt like it could be more expressive. So, I thought I would explore the possibility of extending it. This weekend I had a little time to begin tinkering around in one of my own projects to develop an API that would at least complement the current one.
I ended up with a fluent interface. (Now that I think about it, I guess I am somewhat partial to these. 😄) Here is some of the syntax I've come up with so far:
The above is not comprehensive. I plan to add or have added other common methods like
.to.equal
and.to.strictlyEqual
and.with.all(e => predicate)
.It still needs work--tests, in particular--but I am pretty happy with the API, so far. I wonder whether it should be in Alsatian core, or an extension package people could opt to install separately. What do you think?
The text was updated successfully, but these errors were encountered: