【问题标题】:Cargo test not displaying any output and not showing all tests货物测试未显示任何输出且未显示所有测试
【发布时间】:2021-04-30 07:05:32
【问题描述】:

运行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'

它只运行其中两个,甚至不给我关于失败的信息。

【问题讨论】:

    标签: testing rust rust-cargo


    【解决方案1】:

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

    test common::tests::test_workingdays 
    test documents::tests::create_docs 
    test emailer::tests::test_attachments 
    test emailer::tests::test_format_attachments 
    

    test_attachments 和 test_format_attachments 都失败了,但是 test_format_attachments 在它正在测试的函数中有一个 std::process::exit(1) 条件,因此它在测试能够返回之前终止了进程。

    【讨论】:

      猜你喜欢
      • 2013-08-18
      • 2021-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-21
      • 1970-01-01
      相关资源
      最近更新 更多