Expectations

a minimalist's unit testing framework

This project is maintained by jaycfields

expectations

adding signal, removing noise

10 second example

;; expectations uses the format (expect expected actual) for all tests
;; (equality, expected exception, regex matching, interactions, etc).

;; use expectations to test equality
(expect 1 1)
(expect "foo" "foo")

;; test if the regex is in a string
(expect #"foo" "boofooar")

;; does the form throw an expected exception
(expect ArithmeticException (/ 12 0))

;; expect a value in a collection (k/v for maps)
(expect {:foo 1} (in {:foo 1 :cat 4}))
(expect :foo (in #{:foo :bar}))
(expect :foo (in [:bar :foo]))

;; expect a function to return a truthy value given the actual argument
(expect empty? (list))

More

consistent syntax is very important to expectations, but there are additional features that focus on increasing signal and reducing noise.

expectations is simple to get started with, but also very feature rich. Please click Introduction to begin exploring it's many features

Credit

Expectations is based on clojure.test. clojure.test is distributed under the Eclipse license, with ownership assigned to Rich Hickey.

License

Copyright (c) 2010, Jay Fields All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.