mirror of
https://codeberg.org/JasterV/test-context.git
synced 2026-04-26 18:10:06 +00:00
docs: Skip teardown execution
This commit is contained in:
parent
e0f7f51cba
commit
c2ea69426f
1 changed files with 24 additions and 0 deletions
|
|
@ -77,6 +77,30 @@
|
|||
//! assert_eq!(ctx.value, "Hello, World!");
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! # Skipping the teardown execution
|
||||
//!
|
||||
//! If what you need is to take full __ownership__ of the context and don't care about the
|
||||
//! teardown execution for a specific test, you can use the `skip_teardown` keyword on the macro
|
||||
//! like this:
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use test_context::{test_context, TestContext};
|
||||
//!
|
||||
//! struct MyContext {}
|
||||
//!
|
||||
//! impl TestContext for MyContext {
|
||||
//! fn setup() -> MyContext {
|
||||
//! MyContext {}
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! #[test_context(MyContext, skip_teardown)]
|
||||
//! #[test]
|
||||
//! fn test_without_teardown(ctx: MyContext) {
|
||||
//! // Perform any operations that require full ownership of your context
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
// Reimported to allow for use in the macro.
|
||||
pub use futures;
|
||||
|
|
|
|||
Loading…
Reference in a new issue