diff options
-rw-r--r-- | src/clj/clojure/core.clj | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index 6f41594e..1e6b8355 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -4178,12 +4178,16 @@ (defmacro assert "Evaluates expr and throws an exception if it does not evaluate to - logical true." + logical true." {:added "1.0"} - [x] - (when *assert* - `(when-not ~x - (throw (new AssertionError (str "Assert failed: " (pr-str '~x))))))) + ([x] + (when *assert* + `(when-not ~x + (throw (new AssertionError (str "Assert failed: " (pr-str '~x))))))) + ([x message] + (when *assert* + `(when-not ~x + (throw (new AssertionError (str "Assert failed: " ~message " " (pr-str '~x)))))))) (defn test "test [v] finds fn at key :test in var metadata and calls it, |