I'm not sure, but probably it behaves so because of throwing at macroexpand 
stage.

вторник, 18 декабря 2018 г., 11:29:09 UTC+2 пользователь puzzler написал:
>
> Consider the following macro:
>
> (defmacro f [x] {:pre [(number? x)]} `(+ ~x 5))
> => (f 3)
> 8
> => (f true)
> Unexpected error (AssertionError) macroexpanding f at 
> (test:localhost:62048(clj)*:265:28).
> Assert failed: (number? x)
>
> So, as expected it throws an AssertionError if passed a non-number.
> However, the following test (using is from clojure.test) used to work 
> prior to 1.10, but now fails:
>
> => (is (thrown? AssertionError (f true)))
> Unexpected error (AssertionError) macroexpanding f at 
> (test:localhost:62048(clj)*:268:56).
> Assert failed: (number? x) 
>
> What's odd is that the macro still throws an AssertionError, but the 
> `thrown?` inside the `is` is no longer intercepting the AssertionError, so 
> the test doesn't pass -- instead the error causes a failure in the test 
> suite.
>

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

Reply via email to