humane-test-output/README.org

75 lines
3.1 KiB
Org Mode
Raw Normal View History

2014-03-26 21:54:35 +00:00
#+STARTUP: hidestars showall
* Humane test output for clojure.test
2014-03-27 01:15:40 +00:00
This library does two things:
1. Test output is pretty printed.
2. Equality assertions are also diffed.
2014-03-27 01:12:02 +00:00
To use this library, include it in your dev profile:
2014-03-28 13:04:10 +00:00
: [pjstadig/humane-test-output "0.6.0"]
2014-03-27 01:12:02 +00:00
2014-03-27 16:02:34 +00:00
To activate it you will need to call ~pjstadig.humane-test-output/activate!~.
One way to do this would be to put this in a ~user.clj~ file in your test
classpath.
2014-03-27 01:12:02 +00:00
This test output formatting works great with Emacs and when running Leiningen
in a console. However, some IDEs are also bashing in their own versions of
test formatting. If you are on a mixed team and some members need to disable
2014-03-28 13:05:41 +00:00
humane test output, they can define the ~INHUMANE_TEST_OUTPUT~ environment
variable.
2014-03-28 13:06:06 +00:00
Once humane-test-output is activated, instead of this:
2014-03-26 21:54:35 +00:00
: FAIL in (a-test) (humane_test_output_test.clj:7)
: FIXME, I fail.
: expected: (= {:foo :bar, :baz :quux, :something "a long string?", :another-key "and another value"} {:fo :bar, :baz :quux, :something "a long string?", :another-key "and another value"})
: actual: (not (= {:another-key "and another value", :foo :bar, :something "a long string?", :baz :quux} {:another-key "and another value", :something "a long string?", :fo :bar, :baz :quux}))
:
: FAIL in (a-test) (humane_test_output_test.clj:11)
: FIXME, I fail.
: expected: (= {:foo :bar, :baz :quux} {:foo :bar, :baz :quux} {:fo :bar, :baz :quux})
: actual: (not (= {:foo :bar, :baz :quux} {:foo :bar, :baz :quux} {:fo :bar, :baz :quux}))
:
: FAIL in (a-test) (humane_test_output_test.clj:14)
: FIXME, I fail.
: expected: (list? foo)
: actual: (not (list? {:another-key "and another value", :foo :bar, :something "a long string?", :baz :quux}))
You get this:
: FAIL in (a-test) (humane_test_output_test.clj:7)
: FIXME, I fail.
2014-03-27 01:08:04 +00:00
: expected: {:another-key "and another value",
: :foo :bar,
: :something "a long string?",
: :baz :quux}
: actual: {:fo :bar}
2014-03-27 01:21:12 +00:00
: diff: - {:baz :quux,
: :something "a long string?",
: :foo :bar,
: :another-key "and another value"}
: + {:fo :bar}
2014-03-27 01:08:04 +00:00
:
: FAIL in (a-test) (humane_test_output_test.clj:10)
2014-03-26 21:54:35 +00:00
: FIXME, I fail.
2014-03-27 01:08:04 +00:00
: expected: {:foo :bar, :baz :quux}
: actual: {:fo :bar, :baz :quux}
2014-03-27 01:21:12 +00:00
: diff: - {:foo :bar}
: + {:fo :bar}
2014-03-27 01:08:04 +00:00
:
: FAIL in (a-test) (humane_test_output_test.clj:13)
2014-03-26 21:54:35 +00:00
: FIXME, I fail.
2014-03-27 01:08:04 +00:00
: expected: (list? foo)
: actual: (not
: (list?
: {:another-key "and another value",
: :foo :bar,
: :something "a long string?",
: :baz :quux}))
2014-03-26 21:54:35 +00:00
** License
2014-03-28 13:07:53 +00:00
: Copyright © Paul Stadig and Outpace Systems, Inc. All rights reserved.
:
: Some small bits of code were taken from clojure.test and modified, and are
: Copyright © Rich Hickey. All rights reserved.
:
: Distributed under the Eclipse Public License, the same as Clojure.
** Acknowledgements
I am grateful for design and implementation assistance from Bryce Covert.