unit testing - How to test for thrown exceptions in Clojure? -


When I want to cover the failed status of the test code

I am new in closure, but is it possible to test for exception in any way?

I want to test the following sample code:

  (ns com.stackoverflow.clojure.tests) (XXtat [x] (Case X "A" "A A "" B "" ABC "(-> (Closor.core / format" expression '% s' is not defined. X) (invalid record exception)))))  < / Pre> 

with the following test methods:

  (ns com.stackoverflow.clojure.tests-test (: [Clojure.test: reference: all] [com.stackoverflow.clojure .tests: reference: all]) (dazzling casetest-tests (are (= "a" (casetest "a")) (is (= "ace" (kestet "b"))) - Exposition invalid agreement exception. (Kestet "C"); Ideal Code (Run-Test)   

My project.clj looks like:

  (Defproject com.stackoverflow.clojure/ tests "0.1.0-SNAPSHOT": Description "Closer test-framework test.": Url "http: //example.com/FIXME": license {: name "eclipse public license" : Url "http://www.eclipse.org/legal/epl-v10.html"}: dependence [[org.clojure / clojure] "1.6.0"]]    

You have thrown a for the exception (code is? Expected Expression Class Body))

View

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -