tracing-test icon indicating copy to clipboard operation
tracing-test copied to clipboard

`logs_contain` incompatible with test_case crate

Open barafael opened this issue 1 year ago • 2 comments

We are using the test case crate to define inputs for our tests. The traced_test macro injects the logs_contain function in the subfunctions which test_case generates, which means the function does not exist at the test definition.

#[test_case(1)]
#[test_case(2)]
#[tracing_test::traced_test]
fn its_a_test(input: u32) {
    tracing::info!("{input}");
}

Possibly related: https://github.com/dbrgn/tracing-test/pull/26

barafael avatar Jul 19 '24 10:07 barafael

Would the suggested change in #26 work for you?

dbrgn avatar Jul 19 '24 21:07 dbrgn

I don't think these changes build anymore:

error[E0433]: failed to resolve: could not find `dispatch` in `tracing
`
  --> src/main.rs:10:5
   |
10 |     #[tracing_test::traced_test(target="shorter_name")]
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     could not find `dispatch` in `tracing`
   |     help: a struct with a similar name exists: `Dispatch`
   |

barafael avatar Jul 21 '24 19:07 barafael