"ns" and "in-ns" have special evaluation rules.  In general, they
don't work as you'd expect in block expressions such as "do" or "let".

If you want to create namespaces programatically, use "create-ns" and
"intern".

-SS


On Apr 26, 6:25 pm, David McNeil <mcneil.da...@gmail.com> wrote:
> I am experimenting with clojure.test and I encountered the following
> situation which I cannot explain.
>
> This code:
>
> (println (do
>            (ns ns01
>              (:use clojure.test))
>            (deftest test1 nil)
>            (run-tests)))
>
> Produces the expected result (note: it runs one test):
>
>     Testing ns01
>
>     Ran 1 tests containing 0 assertions.
>     0 failures, 0 errors.
>     {:type :summary, :test 1, :pass 0, :fail 0, :error 0}
>
> However, if I do the exact same thing inside of a let:
>
> (println (let []
>            (do
>              (ns ns02
>                (:use clojure.test))
>              (deftest test1 nil)
>              (run-tests))))
>
> Then I get the unexpected result that no tests are executed:
>
>     Testing ns02
>
>     Ran 0 tests containing 0 assertions.
>     0 failures, 0 errors.
>     {:type :summary, :test 0, :pass 0, :fail 0, :error 0}
>
> Seems there is something going on with namespaces that I do not
> understand and I hope that somewhere here can explain it.
>
> Thank you.
> -David McNeil
>
> --
> 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 
> athttp://groups.google.com/group/clojure?hl=en

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