testing - cargo 测试不显示任何输出也不显示所有测试

标签 testing rust rust-cargo

运行 cargo test没有显示所有 4 个测试,也没有显示我运行的任何测试的任何输出。
我有4个测试:

test common::tests::test_workingdays 
test documents::tests::create_docs 
test emailer::tests::test_attachments 
test emailer::tests::test_format_attachments 
$ cargo test
   Compiling te-pm-analytics v0.1.0 (/home/charlie/thoughtexpress/rust/te-pm-analytics)
    Finished test [unoptimized + debuginfo] target(s) in 2.44s
     Running target/debug/deps/main-253a09bf91ed177c

running 4 tests
test common::tests::test_workingdays ... ok
test emailer::tests::test_attachments ... FAILED
error: test failed, to rerun pass '--bin main'
它只运行其中两个,甚至不给我有关失败的信息。

最佳答案

所以发生这种情况的原因是我进行的 4 次测试

test common::tests::test_workingdays 
test documents::tests::create_docs 
test emailer::tests::test_attachments 
test emailer::tests::test_format_attachments 
两者 test_attachmentstest_format_attachments但是失败了 test_format_attachments有一个 std::process::exit(1)它正在测试的函数内部存在条件,因此它在测试能够返回之前终止了该进程。

关于testing - cargo 测试不显示任何输出也不显示所有测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65902338/

相关文章:

Rust:在系统范围内安装本地构建的可执行文件

ios - 有没有办法让键盘触发按钮按下?

javascript - TypeError : Method Promise.原型(prototype)。然后在不兼容的接收器代理上调用

testing - 如何验证表中的列数?

iterator - 从函数返回的迭代器的生存期要求冲突

testing - 如何运行主二进制文件,然后在 Rust 中运行基于它的测试?

java - 是否可以在测试用例中注册接收器?

input - 打印从标准输入读取的字符串时如何忽略换行符?

rust - 如何通过 Rest api 实现在 Rust 中取得进展的长时间运行的进程?

linux - 使用rust : error cross-compilation from Linux to Windows i686