步骤
(require '[clojure.test :refer :all]) (is (thrown-with-msg? Exception #"123" (throw (ex-info nil {}))))
预期:
在 () 中失败 (form-init1933636226458515246.clj:1) 预期: (thrown-with-msg? Exception #"123" (throw (ex-info nil {}))) 实际: ...
实际:
`
在 () 中错误 (Matcher.java:1283)
预期: (thrown-with-msg? Exception #"123" (throw (ex-info nil {})))
实际: java.lang.NullPointerException: null
在 java.util.regex.Matcher.getTextLength (Matcher.java:1283)
java.util.regex.Matcher.reset (Matcher.java:309)
java.util.regex.Matcher.<init> (Matcher.java:229)
java.util.regex.Pattern.matcher (Pattern.java:1093)
clojure.core$re_matcher.invokeStatic (core.clj:4796)
clojure.core$re_find.invokeStatic (core.clj:4838)
clojure.core$re_find.invoke (core.clj:4838)
user$eval43312.invokeStatic (form-init1933636226458515246.clj:1)
user$eval43312.invoke (form-init1933636226458515246.clj:1)
clojure.lang.Compiler.eval (Compiler.java:7062)
clojure.lang.Compiler.eval (Compiler.java:7025)
clojure.core$eval.invokeStatic (core.clj:3206)
clojure.core$eval.invoke (core.clj:3202)
clojure.main$repl$read_eval_print__8572$fn__8575.invoke (main.clj:243)
clojure.main$repl$read_eval_print__8572.invoke (main.clj:243)
clojure.main$repl$fn__8581.invoke (main.clj:261)
clojure.main$repl.invokeStatic (main.clj:261)
clojure.main$repl.doInvoke (main.clj:177)
clojure.lang.RestFn.invoke (RestFn.java:1523)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__40865.invoke (interruptible_eval.clj:87)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invokeStatic (core.clj:657)
clojure.core$with_bindings_STAR_.invokeStatic (core.clj:1965)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1965)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:85)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:55)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__40910$fn__40913.invoke (interruptible_eval.clj:222)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__40905.invoke (interruptible_eval.clj:190)
clojure.lang.AFn.run (AFn.java:22)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
java.lang.Thread.run (Thread.java:748)
`
ClojureScript
在 () 中错误 (TypeError:NaN:NaN) 预期: (thrown-with-msg? js/Error #"123" (throw (ex-info nil {}))) 实际: #object[TypeError TypeError: re-find 必须与字符串匹配.]