diff --git a/README.md b/README.md index f65ca15..385bd65 100644 --- a/README.md +++ b/README.md @@ -47,42 +47,6 @@ fn test_generic_type(ctx: &mut MyGenericContext) { } ``` -with generic types, you can use same type with different values - -```rust -use test_context::{test_context, TestContext}; -use std::marker::PhantomData; - -struct MyGenericContext { - value: u32, - _marker: PhantomData, -} - -impl TestContext for MyGenericContext { - fn setup() -> MyGenericContext { - MyGenericContext { value: 1, _marker: PhantomData } - } -} - -#[test_context(MyGenericContext)] -#[test] -fn test_generic_type(ctx: &mut MyGenericContext) { - assert_eq!(ctx.value, 1); -} - -impl TestContext for MyGenericContext { - fn setup() -> MyGenericContext { - MyGenericContext { value: 2, _marker: PhantomData } - } -} - -#[test_context(MyGenericContext)] -#[test] -fn test_generic_type_u32(ctx: &mut MyGenericContext) { - assert_eq!(ctx.value, 2); -} -``` - Alternatively, you can use `async` functions in your test context by using the `AsyncTestContext`.