clojure.test are macro

2013-01-28 Thread John Lawrence Aspden
Hi, am I doing something wrong here?: user= (clojure-version) 1.4.0 user= (use 'clojure.test) nil user= (is ((fn[x] x) 1) 1) 1 user= (are [ x y ] (= x y) ((fn[x] x) 1) 1) StackOverflowError clojure.core/map/fn--4087 (core.clj:2426) user= (macroexpand '(are [ x y ] (= x y) ((fn[x] x) 1) 1))

Re: clojure.test are macro

2013-01-28 Thread James Xu
user= (macroexpand-1 (are [ x y ] (= x y) ((fn[a] a) 1) 1)) true user= (macroexpand-1 '(are [ x y ] (= x y) ((fn[a] a) 1) 1)) (clojure.template/do-template [x y] (clojure.test/is (= x y)) ((fn [a] a) 1) 1) The StackOverflowError may have something to do with the do-template func On 13-1-28

Re: clojure.test are macro

2013-01-28 Thread AtKaaZ
= (are [ x y ] (= x y) ((fn[x] x) 1) 1) StackOverflowError clojure.lang.PersistentArrayMap.containsKey (PersistentArrayMap.java:158) = (dorun (map #(println (.toString %)) (take-last 100 (.getStackTrace *e clojure.lang.RestFn.invoke(RestFn.java:408)

Re: clojure.test are macro

2013-01-28 Thread AtKaaZ
well this should explain it: = (are [ x y ] (= x y) ((fn[x] x) 1) 1) StackOverflowError clojure.core/partial/fn--4209 (core.clj:2396) = (are [ x y ] (= x y) ((fn[a] a) 1) 1) true On Mon, Jan 28, 2013 at 4:37 PM, John Lawrence Aspden aspd...@googlemail.com wrote: Hi, am I doing something

Re: clojure.test are macro

2013-01-28 Thread AtKaaZ
sorry, James Xu already said that (didn't want to steal any credit, but I've just realized that he said the same thing) On Mon, Jan 28, 2013 at 5:25 PM, AtKaaZ atk...@gmail.com wrote: well this should explain it: = (are [ x y ] (= x y) ((fn[x] x) 1) 1) StackOverflowError

Re: clojure.test are macro

2013-01-28 Thread Sean Corfield
In other words, don't use the same names for variables in your code under test that you use for the placeholder variables in the `are` binding and the test expressions. I seem to remember this coming up before (fairly recently?) and it was just considered a limitation of the `are` macro

Re: clojure.test are macro

2013-01-28 Thread Brian Marick
On Jan 28, 2013, at 11:13 AM, Sean Corfield seancorfi...@gmail.com wrote: In other words, don't use the same names for variables in your code under test that you use for the placeholder variables in the `are` binding and the test expressions. It might be a good practice to distinguish the

Re: clojure.test are macro

2013-01-28 Thread John Lawrence Aspden
Thanks Guys, I'll avoid the are macro. Any ideas why this doesn't work?: user= (use 'clojure.test) nil user= (use 'clojure.test.tap) nil user= (deftest a (is true)) #'user/a user= (run-tests) Testing user Ran 1 tests containing 1 assertions. 0 failures, 0 errors. {:type :summary, :pass 1,