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

Wrong case signature error on pattern in function parameter #201

Open
sharksforarms opened this issue Jun 27, 2023 · 1 comment
Open

Wrong case signature error on pattern in function parameter #201

sharksforarms opened this issue Jun 27, 2023 · 1 comment

Comments

@sharksforarms
Copy link

Hello! I'm attempting to use patern matching in funciton parameters but I'm getting wrong case signature. Is this currently supported in rstest?

I tried to use cargo expand to see what get's generated, but it doesn't seem to be giving me the generated rstest code for test_test_bad below. How could I debug this?

Reference:
https://doc.rust-lang.org/book/ch18-01-all-the-places-for-patterns.html#function-parameters

Error:
Wrong case signature: should match the given parameters list.

Example:

fn args_tuple(arg1: u8, (arg2, arg3): (u8, u8)) {
    todo!();
}

fn main() {
    args_tuple(1, (2,3));
}

#[cfg(test)]
mod tests {
    use super::args_tuple;
    use rstest::*;

    #[rstest]
    #[case(1, (2, 3))]
    fn test_test_good(#[case] arg1: u8, #[case] args: (u8, u8)) {
        args_tuple(arg1, args);
    }

    #[rstest]
    #[case(1, (2, 3))]
    fn test_test_bad(#[case] arg1: u8, #[case] (arg2, arg3): (u8, u8)) {
        args_tuple(arg1, (arg2, arg3));
    }
}
@la10736
Copy link
Owner

la10736 commented Jun 27, 2023

I'm sorry, this feature is not implemented yet... But could be a great idea to support it

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

2 participants