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.

7 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