Skip to content

misspelling a test name should probably cause failure #35757

@oconnor663

Description

@oconnor663

(Originally filed as rust-lang/cargo#3009.)

I'm worried that it's very easy to misspell a test's name, see the (zero tests) success output from cargo, and miss the fact that your test didn't run. Here's a couple examples from my project. First the correct spelling:

$ cargo test test_file
     Running target/debug/duct-0b3d1841f083e660

running 1 test
test test::test_file ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests duct

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

And misspelled, so that no tests actually run:

$ cargo test tast_file
     Running target/debug/duct-0b3d1841f083e660

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

   Doc-tests duct

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

You can't see it here on GitHub, but the strongest detail in the terminal is that most of the green colored text (the ok's) is the same in both examples. Also because doc tests come after, and I have no doc tests in this project, the last three lines are also the same.

I can't think of a use case where you'd want the test runner to silently do nothing. Can we make running no tests an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions