Commit graph

16 commits

Author SHA1 Message Date
Víctor Martínez
63cb4631a3
chore: internal refactor & update docs (#64) 2025-11-10 11:04:42 +01:00
Víctor Martínez
39756352a8
feat: make it so immutable references & full ownership can be taken depending on context (#58)
This pull requests introduces changes that make the use of the `test_context` macro more flexible.

Now, if the teardown is not skipped (default behavior), either an `immutable` or a `mutable` reference can be used for the context.

If the teardown is skipped with the `skip_teardown` option, an `immutable`, a `mutable` reference or full ownership can be taken.

So now the following is possible:

```rust
#[test_context(TeardownPanicContext, skip_teardown)]
#[tokio::test]
async fn test_async_skip_teardown(_ctx: &mut TeardownPanicContext) {}

#[test_context(TeardownPanicContext, skip_teardown)]
#[tokio::test]
async fn test_async_skip_teardown_with_immutable_ref(_ctx: &TeardownPanicContext) {}

#[test_context(TeardownPanicContext, skip_teardown)]
#[tokio::test]
async fn test_async_skip_teardown_with_full_ownership(_ctx: TeardownPanicContext) {}

#[test_context(TeardownPanicContext, skip_teardown)]
#[test]
fn test_sync_skip_teardown(_ctx: &mut TeardownPanicContext) {}

#[test_context(TeardownPanicContext, skip_teardown)]
#[test]
fn test_sync_skip_teardown_with_immutable_ref(_ctx: &TeardownPanicContext) {}

#[test_context(TeardownPanicContext, skip_teardown)]
#[test]
fn test_sync_skip_teardown_with_full_ownership(_ctx: TeardownPanicContext) {}
```
2025-11-06 13:52:20 +01:00
Vyacheslav
9227f3e693
Added the ability to work with rstest (#51)
* [FIX-CONFLICT-WITH-RSTEST-V2]: semi-stable version, fix test_context function, remove unnecessary field, remove wrapper function, add  ability to work with rstest and same

* [FIX-CONFLICT-WITH-RSTEST-V2]: stable version, fix bugs with AssertUnwindSafe in sync_wrapper_body, remove redundant code, fix two tests, add notes for this tests

* [FIX-CONFLICT-WITH-RSTEST-V2]: stable version, fix context name extraction function, fix readme, fix docs, increase version of crate

---------

Co-authored-by: Vyacheslav Volkov <v.volkov@st-falcon.ru>
2025-10-29 10:19:40 +01:00
Andreas Vilinski
5ce361bc24
docs: explain why #[test_context] must come before #[tokio::test]; clarify attribute expansion order (#49)
Co-authored-by: Andreas Vilinski <andreas.vilinski@ifm.com>
2025-09-23 17:10:59 +02:00
Víctor Martínez
64a4e1ba7f
Update README.md (#47) 2025-01-27 13:58:33 +01:00
Víctor Martínez
9bfe21fa4c
refactor: Support generic types in test_context macro (#45)
* refactor: Support generic types in test_context macro
2025-01-27 12:49:28 +01:00
Changju Lee
a58e13ecf5
feat: Support generic types in test_context macro (#44)
- Allow using test_context with generic contexts like MyContext<T>
2025-01-27 11:53:39 +01:00
Víctor Martínez
dc2992cbff
feat: add support for the skip_teardown keyword (#40)
* feat: add support for the skip_teardown keyword
2024-02-27 23:26:40 +01:00
Victor Martinez
cb4043fae6 refactor: remove support for async-trait crate 2024-02-26 12:05:07 +01:00
Víctor Martínez
b3a7975253
Update README.md 2024-02-25 23:10:57 +01:00
Mark Hildreth
4814198ca2
Update README.md 2024-02-25 15:03:12 -05:00
Kirill Bulatov
8a40f16a34
Use proper World capitalization in the main example 2023-03-28 17:20:03 +03:00
Mark Hildreth
90a3c615ed Documented behavior of AsyncContext with normal function. 2021-02-23 21:02:12 -05:00
Mark Hildreth
fe1175e1fa Added badges 2021-02-07 00:08:29 -05:00
Mark Hildreth
4e3f4ca759 Fixed typo in documentation 2021-02-06 23:48:26 -05:00
Mark Hildreth
daf14d6449 Initial version 2021-01-17 21:23:34 -05:00