Hi Frantisek, Meikel,

Good suggestions, all.  I'll have to spend some time looking at these
and figure out if I can make them work with the existing test-is.  Two
thoughts first:

1. I want to keep optional messages per-assertion.  These are very
useful in the RSpec testing framework for Ruby; they're like comments
explaining what each assertion is supposed to demonstrate.

2. The current 'is' macro works more or less like the one Meikel
described.  The multimethod is "assert-expr", but it's complicated and
could be simplified.

In general, I want to make the library more oriented towards
functional programming, and less reliant on macros.  That should both
simplify the interface and make it easier to add new kinds of
assertions.  Stay tuned.

-Stuart Sierra



On Nov 17, 6:55 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Am 18.11.2008 um 00:13 schrieb Frantisek Sodomka:
>
> > B) What about 'throws' macro? Could this become a function returning
> > true/false? Then we could stick it inside 'is' or 'all-true'. (I  
> > guess it
> > doesn't matter that much, does it?)
>
> I have a is-like construct, which is build-up slightly different.
> Instead of checking, what I get, I immediatelly dispatch to a
> multimethod.
>
> (defmacro is [t msg] (is* t msg))
>
> (defmulti is* (fn [t _] (first t)))
>
> (defmethod is* :default `(simply-run-t-here ...))
> (defmethod is* nil `(always-fail ...))
> (defmethod is* '= `(do-test-here ...))
> (defmethod is* 'not= `(do-test-here ...))
> (defmethod is* 'instance? `(do-test-here ...))
> (defmethod is* 'throwing? `(do-test-here ...))
>
> So it is easy to extend is with other tests, while still being able
> to provide diagnostics in case a test should fail.
>
> Furthermore I use a test driver function, which reduces the repition to
> a minimum. It takes care to run the tests in a try, report the result
> and provide diagnostics in case of a failure. Then each methods above
> just has to specify in a callback how the actual test is carried out and
> what kind diagnostics should be printed. (eg. compare assert-expr
> for = and instance?. They are very similar.)
>
> What do you think about such a structure?
>
> Sincerely
> Meikel
>
>  smime.p7s
> 5KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to