Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uppercase and lowercase generated test function collide #108

Open
ssipos90 opened this issue Dec 3, 2022 · 4 comments
Open

Uppercase and lowercase generated test function collide #108

ssipos90 opened this issue Dec 3, 2022 · 4 comments

Comments

@ssipos90
Copy link

ssipos90 commented Dec 3, 2022

Hello,

If you write tests like this, the generated function names will collide (_a_expects):

    #[test_case('a')]
    #[test_case('A')]
    fn test (_: char) {
    }

I worked around it by adding an extra argument in front:

    #[test_case(1, 'a')]
    #[test_case(2, 'A')]
    fn test (_: u32, _: char) {
    }

Maybe it would be easy to suffix the index of the test case to the generated name (_a_expects_{}).

Thanks.

@luke-biel
Copy link
Collaborator

For now in such cases we provide way to comment test cases. Comments replace usual test name generation. There's more info on wiki https://github.com/frondeus/test-case/wiki/Test-Names.
There was a proposal to allow setting test names manually, but there wasn't enough need for that at the moment and it died, as comments suffice in most cases. As for indexing, maybe it would be nice to append them, but I need to sleep on the idea.

@AugustoFKL
Copy link
Contributor

The solution provided on #19 should resolve this problem, but I'm not sure about a scenario like:

    #[test_case('a')]
    #[test_case('a')]
    fn test (_: u32, _: char) {
    }

Should it be accepted? From a library perspective, I don't see a reason for us to block it, but it would make tracing a bit more difficult.

@frondeus
Copy link
Owner

frondeus commented Jan 24, 2024 via email

@AugustoFKL
Copy link
Contributor

I see

I am studying a way to refine the proposal I did on #19, but if we are considering that tests with the same name shouild not be accepted, then it makes things easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants