la10736 / rstest

Fixture-based test framework for Rust
Apache License 2.0
1.21k stars 43 forks source link

Dynamically set #[values(..)] #254

Closed joshfried-aws closed 6 months ago

joshfried-aws commented 6 months ago

Hey, i am writing some tests using the #[values(..)] macro and was wondering if there was anyway to have them set dynamically. IMO this would make it much cleaner and easier to read, as well as just more maintainable so I dont have to update my tests each time i grow my EXPECTED_PATHS

Here is an example of what i am trying to do.

#[rstest::rstest]
#[tokio::test]
async fn test_single_file_loader(
        #[values(EXPECTED_PATHS[0], EXPECTED_PATHS[1], EXPECTED_PATHS[2])] file_name: &str,
    ) -> anyhow::Result<()> {
        todo!()
    }
la10736 commented 6 months ago

Sadly is not possible :cry:. See #252