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

Support dynamic #[values] #252

Closed
tomasol opened this issue May 10, 2024 · 1 comment
Closed

Support dynamic #[values] #252

tomasol opened this issue May 10, 2024 · 1 comment

Comments

@tomasol
Copy link

tomasol commented May 10, 2024

It would be nice to provide the list of values by a function:

Example:

#[derive(strum_macros::EnumIter, Debug, PartialEq)]
enum Color {
    Red,
    Green,
    Blue,
}
#[rstest]
#[test]
fn test(#[values_dyn( Color::iter() )] value: Color) {
..
@la10736
Copy link
Owner

la10736 commented May 13, 2024

As I already mentioned in lot of tickets about this topic (#29 is just one of them), Rust is not Python. When the #[rstest] procedural macro is processed we don't know anything about Color type because we are in an early stage where just the abstract syntax tree was build so we cannot process Color::iter() to generate the 3 test functions to compile.

@la10736 la10736 closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
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