4 releases
0.2.2 | Mar 22, 2022 |
---|---|
0.2.1 | Mar 9, 2022 |
0.2.0 | Mar 9, 2022 |
0.1.0 | Mar 8, 2022 |
#6 in #teardown
6,187 downloads per month
Used in pg_sync
25KB
332 lines
Description
Jest style setup and teardown test helpers.
Currently implemented:
-
#[after_all]
: Only valid on amod
. Requires a single function namedafter_all
. Counts the number of functions with atest
attribute applied and runs the body of theafter_all
function after all the tests have run. -
#[after_each]
: Only valid on amod
. Requires a single function namedafter_each
. Copies the body contents of theafter_each
function into the end of the function body of any functions in the samemod
that have atest
attribute applied. -
#[before_all]
: Only valid on amod
. Requires a single function namedbefore_all
. Runs the contents ofbefore_all
exactly once before any tests have run. -
#[before_each]
: Only valid on amod
. Requires a single function namedbefore_each
. Copies the body contents of thebefore_each
function into the beginning of the function body of any functions in the samemod
that havetest
attribute applied.- N.B. A function with a
test
attribute applied is any function with an attribute with the wordtest
in it. So,#[test]
,#[tokio::test]
, and#[test_case(blah)]
will all count for the before/after hooks.
- N.B. A function with a
-
#[skip]
: Valid on amod
or an individual test. Will skip the mod or test it is applied on.
To do:
#[only]
: Not sure how to implement this one, tbh.
Dependencies
~1.5MB
~37K SLoC