2

If you enter the command line cargo test --help, the following message is shown:

The test filtering argument TESTNAME and all the arguments following the two dashes (--) are passed to the test binaries and thus to libtest (rustc's built in unit-test and micro-benchmarking framework). If you're passing arguments to both Cargo and the binary, the ones after -- go to the binary, the ones before go to Cargo. For details about libtest's arguments see the output of cargo test -- --help.

I do not understand the principle idea of that. Is libtest not included in cargo test execution? What's the difference between both? Can someone explain how it works with examples and the main idea of passing arguments using two dashes?

hellow
  • 9,446
  • 5
  • 41
  • 61
Aipi
  • 1,198
  • 2
  • 16
  • 24
  • 3
    It's a UNIX convention: https://unix.stackexchange.com/a/187548/5217 – Sean Vieira Jul 08 '19 at 21:31
  • 1
    `cargo test` compiles the tests and runs the test binaries. The arguments to Cargo control how to compile and run the binaries, while the arguments after `--` are simply passed through to the binaries. – Sven Marnach Jul 08 '19 at 21:45

0 Answers0