When I started working on this library, I thought to myself, "I can't
believe no one has put together an expectation/mocking library" but I
couldn't find one so I went ahead and started my own.  Of course, it
was not until I had an early working version that I discovered Allen
Rohner's expectation tools, but I figured that mine were sufficiently
different to merit further development (at least relative to the
latest code of his I could find).

In the past week or so I've been refactoring and fixing bugs on my
test-expect library and I find it much improved over what I previously
had.  The salient improvements on the latest on trunk include:

- Removal of dependency on test-is.  Tests have been moved to a
separate file instead.  The library is still geared toward easy
integration with test-is, but the explicit dependency is gone.

- Replaced "exceptions on error" with the new and improved error
functions that are ready to be overridden or used as-is.  They also
include reporting the expected behavior in an unevaluated form, a la
test-is.

- Added convenience methods such as (once) (more-than x) for
invocation count and argument matching.\

- Default has-args argument matchers to being equality matchers so you
can say (has-args [5]) instead of (has-args [#(= 5 %)])

- Bug fixes

The latest is available for public consumption at 
http://code.google.com/p/test-expect/
Basically the gist of it is it sets up the bindings for any functions
you'd rather not touch while testing the function you're working on.
So, you just say:

(expect [dep-fn1 (has-args [5 (less-than 4)] (returns "a string!"))]
(fn-under-test-which-calls-dep-fn1))

Any unexpected or unmatched calls are reported.  Successful execution
is silent, which mirrors other libraries I have used in other
languages. Further details to be found in the source.

Suggestions for further changes or improvements are more than
welcome.  If people find this library useful I'd be more than happy to
sign the CA and put this in contrib. Also, Allen, if you are
interested in merging our efforts let me know.  Is your latest code
available?

-Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to