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

#7 in #teardown

Download history 1449/week @ 2024-09-13 2023/week @ 2024-09-20 1309/week @ 2024-09-27 1109/week @ 2024-10-04 1687/week @ 2024-10-11 1537/week @ 2024-10-18 1589/week @ 2024-10-25 1136/week @ 2024-11-01 1930/week @ 2024-11-08 1792/week @ 2024-11-15 1642/week @ 2024-11-22 1177/week @ 2024-11-29 1029/week @ 2024-12-06 1447/week @ 2024-12-13 805/week @ 2024-12-20 464/week @ 2024-12-27

3,945 downloads per month
Used in pg_sync

MIT license

25KB
332 lines

Build Status Crates.io Documentation

Description

Jest style setup and teardown test helpers.

Currently implemented:

  • #[after_all]: Only valid on a mod. Requires a single function named after_all. Counts the number of functions with a test attribute applied and runs the body of the after_all function after all the tests have run.

  • #[after_each]: Only valid on a mod. Requires a single function named after_each. Copies the body contents of the after_each function into the end of the function body of any functions in the same mod that have a test attribute applied.

  • #[before_all]: Only valid on a mod. Requires a single function named before_all. Runs the contents of before_all exactly once before any tests have run.

  • #[before_each]: Only valid on a mod. Requires a single function named before_each. Copies the body contents of the before_each function into the beginning of the function body of any functions in the same mod that have test attribute applied.

    • N.B. A function with a test attribute applied is any function with an attribute with the word test in it. So, #[test], #[tokio::test], and #[test_case(blah)] will all count for the before/after hooks.
  • #[skip]: Valid on a mod 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
~38K SLoC