Skip to content

Instantly share code, notes, and snippets.

@CampingScorpion
Created December 24, 2011 20:44
Show Gist options
  • Save CampingScorpion/1518307 to your computer and use it in GitHub Desktop.
Save CampingScorpion/1518307 to your computer and use it in GitHub Desktop.
nested fact descriptions
(facts "about mathematics"
(fact "addition is commutative"
(+ 1 2) => 3
(+ 2 1) => 4) ;; FAIL
(fact "multiplication is commutative"
(* 2 5) => 10
(* 5 2) => 11)) ;; FAIL
;; These would report as:
;; FAIL: "about mathematics, addition is commutative" at (core.clj:995)
;; ...
;; FAIL: "about mathematics, multiplication is commutative" at (core.clj:999)
;; ...
@bmabey
Copy link

bmabey commented Dec 26, 2011

Looking good... this would fit well into my current use of midje. Right now I've been doing the same thining, more or less, but without explicit support from midje. How hard would it be to allow for docstrings in the provided (and maybe background) forms as well? At times I find myself doing things like (fact ... (provided ; that blah blah errors out ...)).

@bmabey
Copy link

bmabey commented Dec 26, 2011

BTW, is midje setup to add different formatters (for reports)? It used to ride on top of clojure.test but with lein-midje I suspect it now has its own reporting functionality. Anyways, the reason why I bring it up is because rspec has a number of formatters and one of them the "nested" formatter which is really nice for tests like this. (It basically prints the tests out in similar intentation as they appear in the file.)

@CampingScorpion
Copy link
Author

CampingScorpion commented Dec 26, 2011 via email

@CampingScorpion
Copy link
Author

CampingScorpion commented Dec 26, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment