https://github.com/marick/Midje
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
-----
Brian Marick, Artisanal Labrador
Now working at http://path11.com
Contract programming in Ruby and Clojure
Occasional consulting on Agile
the simplest way to test functions is to define tests using deftest,
and to assert things using is
(use '[clojure.test :only [deftest is]])
(defn foo [x] (+ x 1))
(deftest test-foo ;; deftest creates a var, so needs to have a
different name from the function being tested
(is (= (foo 1) 2)))
you can run all the tests in a namespace using (run-all-tests)
clojure.test includes a few other things (fixtures, are assertions,
testing blocks, etc) but is generally a simple bare bones library.
`lein test` is a task for the lein build tool that runs clojure.test
tests if your project is a lein project.
the lein convention is to package tests in a separate namespace from
what is tested.
tests for the namespace foo.bar are in the namespace foo.test.bar.
the files backing test namespaces are also kept in a separate
directory, ./src vs. ./test
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?
specifically, it plays well with IntelliJ, and gives you an easy way
to run all your clojure tests using IntelliJ's built in junit
integration.
Cheers, Jay