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 atestattribute applied and runs the body of theafter_allfunction after all the tests have run. -
#[after_each]: Only valid on amod. Requires a single function namedafter_each. Copies the body contents of theafter_eachfunction into the end of the function body of any functions in the samemodthat have atestattribute applied. -
#[before_all]: Only valid on amod. Requires a single function namedbefore_all. Runs the contents ofbefore_allexactly once before any tests have run. -
#[before_each]: Only valid on amod. Requires a single function namedbefore_each. Copies the body contents of thebefore_eachfunction into the beginning of the function body of any functions in the samemodthat havetestattribute applied.- N.B. A function with a
testattribute applied is any function with an attribute with the wordtestin 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 amodor an individual test. Will skip the mod or test it is applied on.
To do:
#[only]: Not sure how to implement this one, tbh.