← 返回刚才阅读的位置

知识卡片

操作参考卡 · 6075.d.13 · 生成模型:未记录

测试参数与输出捕获

理解等级:初级

cargo test --help 查看 Cargo 的测试选项,cargo test -- --help 查看测试运行器选项。默认失败用例会显示捕获到的输出。用 cargo test -- --show-output 在报告中查看通过用例产生的输出。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《The Rust Programming Language(第2版)》第11章 编写自动化测试(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c11.xhtml`,块 0139) - 结论依据:原文明确 `--` 分隔 Cargo 和测试二进制的参数。 - 原始内容:Some command line options go to cargo test, and some go to the resultant test binary. To separate these two types of arguments, you list the arguments that go to cargo test followed by the separator -- and then the ones that go to the test binary.