作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在处理一个跨多个 crate 的项目。顶级 crate(应用程序)需要其他两个 crate(库)作为依赖项。在顶级 crate 中运行 cargo test
构建依赖关系并为顶级 crate 运行测试,但它不会为其他两个 crate 运行测试。有没有办法配置 cargo test
以便它在所有三个箱子中运行测试?
谢谢!
最佳答案
您可以传递 -p
参数让 Cargo 运行依赖项的测试。
因此,如果您的 crate 名为 sublib
,您可以使用以下方式运行其测试:
cargo test -p sublib
来自 cargo test --help
:
-p SPEC, --package SPEC Package to run tests for
If the --package argument is given, then SPEC is a package id specification which indicates which package should be tested. If it is not given, then the current package is tested. For more information on SPEC and its format, see the
cargo help pkgid
command.
关于rust - 如何让 Cargo 运行本地依赖项的测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28416448/
我是一名优秀的程序员,十分优秀!