Skip to content

Leave annotated item outside test module #77

@nakedible

Description

@nakedible

I'm not sure if I'm the only one asking for this, but this feels like a no brainer, so it's kind of curious...

I want to use #[test_case] annotations on functions that are not test functions but the actual functions that implement things. They might be a part of the public API, or just used by many other functions in the same file. This would be similar to writing a "doc test", but a doc test is necessarily 3 lines and quite verbose compared to just a test_case annotation. Additionally, doc tests are not part of the normal unit test frameworks, but instead handled with a special binary, which causes all sorts of annoyance.

Currently, just adding the annotation causes there to be a module added with the function name, and the function to be moved inside that module, and then followed by all the generated test case functions. Instead, I would want the module to be named test_<ident>, the generated test cases placed inside that and the function to be left exactly as is. To be honest, that's how I assumed this to work.

This would probably need to be a flag, or a separate macro, since I guess all the current users assume that the test case function is purely for testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    next releaseIssues that are meant to release with next minor/major release

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions