生锈测试货物测试 - verbose不显示ouptut?

发布于 2025-02-08 22:39:54 字数 468 浏览 3 评论 0原文

如果我创建该功能

#[test]
fn foo () {
  dbg!("BAR");
  println!("BAZ");
  assert!(true);
}

,并且运行货物测试-V货物测试-Verbose我可以确认测试运行,但没有显示输出。输出中不存在“ bar”和“ baz”一词。

当我阅读货物测试-HELP时,我看到的选项与货物-HELP:IT文档a -vv选项。但是我看不出与货物 - Verbose Test -VV,NOR 货物测试-VV的区别。


我正在使用货物1.63.0夜晚(4D92F07F3 2022-06-09)

If I create the function

#[test]
fn foo () {
  dbg!("BAR");
  println!("BAZ");
  assert!(true);
}

And I run cargo test -v or cargo test --verbose I can confirm the test ran, but no output is shown. The words "BAR" and "BAZ" do not exist in the output.

When I read cargo test --help, I see different options than in cargo --help: it documents a -vv option. But I don't see a difference with cargo --verbose test -vv, nor cargo test -vv.


I'm using cargo 1.63.0-nightly (4d92f07f3 2022-06-09)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耳根太软 2025-02-15 22:39:54

- Nocapture

此处的正确调用是

cargo test -- --nocapture

文档,

默认情况下,生锈测试线束会隐藏测试执行中的输出,以保持结果可读。可以通过将- Nocapture传递到测试二进制文件来恢复测试输出(例如,调试):

 货物测试 -   -  nocapture
 

我已经打开了 github上的问题#10777建议更改此行为

--nocapture

The right invocation here is

cargo test -- --nocapture

From the docs,

By default the Rust test harness hides output from test execution to keep results readable. Test output can be recovered (e.g., for debugging) by passing --nocapture to the test binaries:

cargo test -- --nocapture

I've opened Issue #10777 on GitHub to suggest changing this behavior

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文