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

Iterable args: a way to expand a given argument of test_matrix #142

Open
fenollp opened this issue Mar 4, 2024 · 0 comments
Open

Iterable args: a way to expand a given argument of test_matrix #142

fenollp opened this issue Mar 4, 2024 · 0 comments

Comments

@fenollp
Copy link

fenollp commented Mar 4, 2024

I'd like to be able to

fn things() -> Vec<T> { .. }

#[test_matrix([false,true], things())]
fn my_func(a: bool, b: T) { .. } 

(meaning: expand things() into its values, like the literal list to the left).
Today this doesn't compile, saying that b's type doesn't match things() (and that's expected).

How do you think this can be solved?

  • should we allow this IFF things() returns impl IntoIterator<Item = T>?
  • should we allow a modifier on arguments to mark these to interpret as iterators?
#[test_matrix([false,true], from: things())]
fn my_func(a: bool, b: T) { .. } 
// How about a prelude providing say `iter(..)`
#[test_matrix([false,true], iter(things()))]
fn my_func(a: bool, b: T) { .. } 
  • is there a const restriction on things()?

BTW could you merge test_matrix's wiki this repo's? There's a new page as well as other modifications
#128 (comment)

Thanks!

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

1 participant