Re: [ANN]: Matcha, a library for composable test assertions with human readable error messages
This looks pretty cool! One thing I wonder, though, why am I seeing all these \n values rather than actual newlines in the actual value, which would make the output so much easier to read? Is there any way to configure or use it differently that would avoid this issue? (This is with lein test right after adding the dependency to my project.clj and changing one test to use matcha). Also, the expected message looks a little broken, should it not instead say something like expected: a map with entry :status that equals 201? (there is no word between that and 201): FAIL in (starting-and-stopping-production-server-works-as-expected) (httpkit_test.clj:17) start-production-server causes HttpKit and Hazelcast to start expected: a map with entry :status that 201 actual: a map with 200\n class java.lang.Integer\ndiff:\n +: 201\n\n -: 200\n at key :status (was {:orig-content-encoding nil, :trace-redirects [\http://localhost:12081/idp/status\;], :request-time 355, :status 200, :headers {\Date\ \Tue, 26 May 2015 21:36:11 GMT\, \Server\ \http-kit\, \Content-Length\ \319\, \Content-Type\ \application/json\}, :body \{\\n \\\status\\\ : \\\up\\\,\\n \\\database\\\ : \\\READ FAILED\\\,\\n \\\build\\\ : \\\DEV\\\,\\n \\\time\\\ : \\\2015-05-26T21:36:11Z\\\,\\n \\\loadAverage\\\ : 1.82666015625,\\n \\\heap\\\ : {\\n \\\committed\\\ : 476053504,\\n\\\max\\\ : 3817865216,\\n \\\used\\\ : 277027488\\n },\\n \\\nonHeap\\\ : {\\n \\\committed\\\ : 75104256,\\n\\\max\\\ : -1,\\n\\\used\\\ : 71632504\\n }\\n}\}) On Monday, May 25, 2015 at 3:27:13 PM UTC-5, tcrayford wrote: Matcha lets you write flexible, composable test assertions with human friendly error messages. It's modeled after the excellent Java Hamcrest library. As a quick example, you might build up a matcher that says this map has 5 elements, and the :foo key must be greater than 10 like so: ``` (require '[matcha :as m]) (deftest my-map-test (m/is (m/and (m/has-entry-that :foo (m/ 10)) (m/has-count 5)) my-map)) ``` If that ever returns false, you'll get an *excellently* readable error message, detailing exactly why it failed. Matcha is completely test framework independent, though it does ship with clojure.test support out of the box. Wiring it up to your test framework of choice should take only a few minutes. Read more examples here http://yellerapp.com/posts/2015-25-05-matcha.html, grab the code on github https://github.com/yeller/matcha or checkout the api docs http://yeller.github.io/matcha/doc/matcha.html. -- 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.
Re: [ANN]: Matcha, a library for composable test assertions with human readable error messages
Oh, sorry, here is my actual test: (m/is (m/has-entry-that :status (m/= 200)) (http/get http://localhost:12081/idp/status;)) -- 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.
Re: [ANN]: Matcha, a library for composable test assertions with human readable error messages
The API docs need a little love too... It seems that the examples for has-nth are actually for has-count; the second example for both has-denominator and has-numerator are actually about nil?, the examples for has-key appear to actually be testing the values, not the keys, the examples for not are reversed... Actually, rather than make you wade through and figure out what I mean, I will just submit a pull request, and suggest some improved wording and more disambiguation while I am at it. Someone will need to double check the examples I came up with for has-nth because I came up with them by inspecting the code, and I am new to this package. Also, for clarity, I proposed adding the following example for matcha/every? (matcha/run-match (matcha/every? (matcha/= 1)) []) ; = passes Is this true? An empty sequence does not have any items which fail, so I would expect so. I am not sure if the isa? documentation is correct. It looks backwards to me, but I may just not understand what isa? is trying to test. Which suggests it could and should be clarified, at least! Anyway, please take my suggestions and questions in the spirit in which I intend them: Excitement about this new package, and a desire to help it get even better! -James On Monday, May 25, 2015 at 3:27:13 PM UTC-5, tcrayford wrote: Matcha lets you write flexible, composable test assertions with human friendly error messages. It's modeled after the excellent Java Hamcrest library. As a quick example, you might build up a matcher that says this map has 5 elements, and the :foo key must be greater than 10 like so: ``` (require '[matcha :as m]) (deftest my-map-test (m/is (m/and (m/has-entry-that :foo (m/ 10)) (m/has-count 5)) my-map)) ``` If that ever returns false, you'll get an *excellently* readable error message, detailing exactly why it failed. Matcha is completely test framework independent, though it does ship with clojure.test support out of the box. Wiring it up to your test framework of choice should take only a few minutes. Read more examples here http://yellerapp.com/posts/2015-25-05-matcha.html, grab the code on github https://github.com/yeller/matcha or checkout the api docs http://yeller.github.io/matcha/doc/matcha.html. -- 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.
[ANN]: Matcha, a library for composable test assertions with human readable error messages
Matcha lets you write flexible, composable test assertions with human friendly error messages. It's modeled after the excellent Java Hamcrest library. As a quick example, you might build up a matcher that says this map has 5 elements, and the :foo key must be greater than 10 like so: ``` (require '[matcha :as m]) (deftest my-map-test (m/is (m/and (m/has-entry-that :foo (m/ 10)) (m/has-count 5)) my-map)) ``` If that ever returns false, you'll get an *excellently* readable error message, detailing exactly why it failed. Matcha is completely test framework independent, though it does ship with clojure.test support out of the box. Wiring it up to your test framework of choice should take only a few minutes. Read more examples here http://yellerapp.com/posts/2015-25-05-matcha.html, grab the code on github https://github.com/yeller/matcha or checkout the api docs http://yeller.github.io/matcha/doc/matcha.html. -- 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.