Skip to content

tests with #[should_panic] should print a message on failure #60790

Closed

Description

When a #[should_panic] #[test] fails because there was no panic it should produce an error message to that effect.

For example, the following test:

#[test]
#[should_panic]
fn doesnt_actually_panic() {}

when run with cargo test produces the following output:

test doesnt_actually_panic ... FAILED

failures:

failures:
    doesnt_actually_panic

There is no indication why it failed. Which can be problematic if the test itself is created by a macro. Example: https://github.com/BurntSushi/fst/blob/master/src/raw/tests.rs#L131-L140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions