On Dec 22, 2010, at 6:52 AM, Alyssa Kwan wrote:

> The issue is where do I specify that:
> (undo-fn ...patch...) => (fn [] (reset! visible-evidence-of-a-side-
> effect :happened!))


The code you quoted is that specification. It doesn't matter that undo-fn is a 
multimethod.

Here's what the notation of the test says:

   When called with an arbitrary patch, undo-patch will produce a particular 
side effect. It does that because it uses undo-patch, which--when given that 
arbitrary patch--returns a function that produces that side effect. 
   It also calls remove-patch with the given patch.
   undo-patch can return anything it wants. We don't care.

> 
> (fact "The patch's undo-fn is called for its side effect and the patch is 
> forgotten"
>  (let [visible-evidence-of-a-side-effect (atom nil)]
>    (undo-patch ...patch...) => anything
>    (provided
>      (undo-fn ...patch...) => (fn [] (reset! 
> visible-evidence-of-a-side-effect :happened!))
>      (remove-patch ...patch...) => :nothing-of-interest)
>    @visible-evidence-of-a-side-effect => :happened!))


-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Author of /Ring/ (forthcoming; sample: http://bit.ly/hfdf9T)
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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