ok, just for the record, I fixed it. Instead of (resolve 'a) you must use (ns-resolve 'test-namespace 'a), because lein test runs the tests in namespace 'userinstead of the one that defined the test (as I wrongly assumed). Also the first test for the existence of the var is wrong, I assumed resolve will raise an exception if not found, but it returns nil. Moral: sleep deprivation is bad for debugging :)
Saludos, Nahuel Greco. On Mon, May 26, 2014 at 5:05 AM, Nahuel Greco <ngr...@gmail.com> wrote: > This works ok at the REPL: > > (def ^{:k :v} a 4) > (:k (meta (resolve 'a))) > ;=> evaluates to :v, ok. > > But the same didn't worked inside a clojure.test/deftest: > > (deftest mytest > (def ^{:k :v} b 4) > (is (= (resolve 'b) nil)) ;; passed, var is resolved ok > (is (= (:k (meta (resolve 'b))) :v))) ;; fails, metadata is nil > > I know deftest wraps his body in a fn, but this works ok: > > ((fn [] > (def ^{:k :v} c 4) > (:k (meta (resolve 'c))) > )) > > Why the deftest case is not working? > > > Saludos, > Nahuel Greco. > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.