Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 21, 2012
@drankard drankard added dosync-test d5944d5
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/avout/test/dosync_test.clj
View
24 test/avout/test/dosync_test.clj
@@ -0,0 +1,24 @@
+(ns avout.test.dosync-test
+ (:use [clojure.test])
+ (:require [avout.core :as avout]))
+
+;; Just because im am curious as why you have the coll? check in core.deref!! ?
+;; `(if (or (coll? '~client)
+;; (not (instance? org.apache.zookeeper.ZooKeeper ~client)))
+;; (throw (RuntimeException. "First argument to dosync!! must be a ZooKeeper client instance."))...
+;; Is it to avoid sideeffects of unquoting ~client ?
+
+
+(def zk-client (ref nil))
+
+(defmacro my-dosync!!-1 [& body]
+ `(let [a# @zk-client] ;; I have to deref before i call dosync!!
+ (avout/dosync!! a# ~@body)))
+
+(defmacro my-dosync!!-2 [& body]
+ `(avout/dosync!! @zk-client ~@body)) ;; This will fail
+
+(deftest dosync-test-1
+ (dosync (ref-set zk-client (avout/connect "127.0.0.1")))
+ (is (my-dosync!!-1 true))
+ (is (my-dosync!!-2 true)))

No commit comments for this range

Something went wrong with that request. Please try again.