Monday, December 13, 2010

scala specs functional matchers

I was reading http://code.google.com/p/specs/wiki/MatchersGuide and wondered if new matchers could be defined more tersely than:



So here it is, with a couple of implicits:



The example shows how to promote a function to a matcher. Currently I didn't find how to define
a function literal with call-by-name semantics, but for simple matchers where a call-by-value semantic is acceptable this trick works fine.

8 comments:

  1. You can have a look at the new ways to create matchers in specs2, they are much easier to create now.

    ReplyDelete
  2. Obtain Quick pen.io Facebook Auto likes on Status and Click Here Photographs and videos and also DJ Liker Download on your Android, PC & iPhone Devices statements messages within DJ Liker App secs status & photos likes messages DJ Liker within some minutes.

    ReplyDelete
  3. The crotch band need to be secured close tumblr.com/ enough to the back that the child cannot Page slide via one side.The buckles should Best Child Feeding High Chair In India be simple for you, but not your kid, to launch.

    ReplyDelete