Skip to content

Commit

Permalink
Fix missing return value in with-statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
soasme committed Sep 21, 2014
1 parent 9d3a06c commit 06416cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/beanstalk_clj/core.clj
Expand Up @@ -154,8 +154,10 @@
of all of the operations within the dynamic scope of body of code."
[beanstalkd & body]
`(binding [*beanstalkd* ~beanstalkd]
~@body
(.close *beanstalkd*)))
(let [rs# (do ~@body)]
(.close *beanstalkd*)
rs#)))


(defn inject-beanstalkd
[multifn]
Expand Down
8 changes: 8 additions & 0 deletions test/beanstalk_clj/core_test.clj
Expand Up @@ -295,3 +295,11 @@
(is (= "ready" (:state (stats-job job))))
(reserve)
(delete jid)))))

(deftest with-statement-return-value
(testing "return"
(is (number? (with-beanstalkd (beanstalkd-factory)
(let [jid (put "return")
job (reserve)]
(delete jid)
jid))))))

0 comments on commit 06416cb

Please sign in to comment.