On Mon, Nov 8, 2010 at 2:01 PM, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> Hi,
>
> session will be fully qualified. this is the default behavior.
> If you really want it, then you can treat it as the result of the
> unquoting of a value which resolves to a symbol.
>
> So you'll use ~ to say you want the value of .... (quote session)
> (quote session returns the symbol session when evaluated).
>
> that is, use ~'session instead of just session.

Ugh.

What you really want in this case is a binding. Try this:


(defmacro def-dispatcher-test [test-name state command session-sym & body]
 `(deftest ~test-name
    (let [~session-sym (test-session ~state)]
      (dispatcher ~command ~session-sym)
      ~...@body)))

(def-dispatcher-test user-test :authorization "USER bugs" session
   (is (= (:user @session) "bugs"))
   (is (= (get-one session) "+OK Hello bugs\n")))


The added parameter just before the body specifies a name to bind the
session object to; this name can then be used in the body.

-- 
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