example.core
An alternative to adding example fn calls in comment blocks.
Simply wrap an example fn call in a call to the ex or
describe macro and run shex in the REPL. Can also be used to
generate unit tests. See example.tests.midje.
add-example!
(add-example! e)
Add the example e if it does not exist for the current
namespace. Returns nil.
cex
(cex)
Clear all examples for all namespaces.
describe
macro
(describe description & body)
drop-last!
(drop-last!)
(drop-last! n)
(drop-last! n ns-sym)
Drop the last n examples in the current ns. Optionally,
pass a namespace symbol.
ex
macro
(ex & forms)
Create multiple examples at one time with optional
description string.
example
macro
(example form)
Pass a form unquoted. Form will not be called unless
show-examples is called.
get-examples
(get-examples)
(get-examples ns-sym)
Get all examples or all examples in a particular
namespace. Useful for debugging.
no-wrap
macro
(no-wrap & body)
Always print code and output on one line.
rex
(rex ns-sym)
(rex ns-sym & descs)
Reload all examples for the given namespace. Optionally
pass one or more descriptions.
shex
(shex)
(shex ns-sym)
(shex ns-sym & descs)
Show all the examples for all namespaces, or optionally
pass a single namespace and one or more descriptions.
shex#
macro
(shex# pattern)
Given a glob pattern, show all examples for matching
namespaces.
Example:
(shex# my.*)
shex*
(shex* pattern)
Given a glob pattern, show all examples for matching
namespaces. Use shex#.
unex
(unex ns-sym)
Unload all examples for the given namespace.
with-inner-container
macro
(with-inner-container & body)
with-threshold
macro
(with-threshold x & body)
Print output on separate line when overall length
is greater than or equal to x characters.
wrap
macro
(wrap & body)
Always print code and output on separate lines.