On Wednesday, February 19, 2014 2:14:52 PM UTC-5, John Wiseman wrote: > I think I'd like to be able to define test cases at run-time. > > For example, I have some data files that define the tests > I want to run (tuples of [program input, class name, > program output]). I've looked at clojure.test and midje > but they only seem to have macro interfaces to their > testing engines, not functional interfaces,
clojure.test really doesn't do much. deftests are just functions, so they can run any arbitrary code you want. The implementation of `clojure.test/testing` is just `(binding [*testing-contexts* (conj *testing-contexts* ~string)] ~@body)) You can trivially rebind *testing-contexts* in your code. The `is` macro is just a fancy version of `assert` that calls `do-report` with the result. (if result# (do-report {:type :pass, :message ~msg, :expected '~form, :actual ...}) (do-report {:type :fail, :message ~msg, :expected '~form, :actual ...})) So you can generate your own test expressions at runtime. -S -- 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/groups/opt_out.