I have a Rust library that implements a lint plugin. I want to include compiletest
, but not require it outside of testing. What is the correct way to specify that the dependency is for testing only?
What is Dependency Testing? Dependency Testing, a testing technique in which an application's requirements are pre-examined for an existing software, initial states in order to test the proper functionality. The impacted areas of the application are also tested when testing the new features or existing features.
A test -scoped dependency is a dependency that is available on the classpath only during test compilation and test execution. If your project has war or ear packaging, a test -scoped dependency would not be included in the project's output archive.
So, what is a unit testing dependency? It's a dependency that you must set up in the test before you can exercise the system under test. Dependencies can be explicit, like in the example above, but they also can be implicit.
Yes. Use dev-dependencies
. From the Cargo docs:
You can add a
[dev-dependencies]
section to yourCargo.toml
whose format is equivalent to[dependencies]
:[dev-dependencies] tempdir = "0.3"
Dev-dependencies are not used when compiling a package for building, but are used for compiling tests, examples, and benchmarks.
When possible, you should also use Cargo's resolver version 2 to better handle complicated dev-dependency cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With