Skip to content

Maybe document with-test? #10

@seancorfield

Description

@seancorfield

clojure.test/with-test allows tests to be defined around a function definition. I've never seen anyone do this but it does work with expectations too:

(with-test 
  (defn foobar [x] 
    (* 2 x)) 
  (expect 4 (foobar 2)) 
  (expect even? (foobar 13)))
(foobar 1) ;=> 2
(test-vars [#'foobar]) ; runs the tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions