3

I'm having problem on a specific function of a test of a specific file:

mod test {
//...

 #[test]
    #[cfg(feature = "proto-igmp")]
    fn test_handle_igmp() {

I've found here https://github.com/rust-lang/cargo/issues/1407 that I can test specific tests by passing its name as an argument to the test binary. But where's such binary? And can I make println work inside tests?

I want to run test_handle_igmp to print some things and see why the error is happening.

Guerlando OCs
  • 1,886
  • 9
  • 61
  • 150

1 Answers1

3

You can find it in target/$MODE/$NAME-$hash, e.g. target/debug/example-3beac917983bc7e3.exe. Note that there might be multiple ones, some for doc tests, some for #[test] functions.

That being said if you just want to run test_handle_igmp, you can just use

cargo test test_handle_igmp -- --nocapture

to run your test and see the println outputs. See cargo test --help or the online documentation.

Zeta
  • 103,620
  • 13
  • 194
  • 236