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

type-parametrized test cases #6

Open
ubnt-intrepid opened this issue Feb 22, 2020 · 0 comments
Open

type-parametrized test cases #6

ubnt-intrepid opened this issue Feb 22, 2020 · 0 comments
Milestone

Comments

@ubnt-intrepid
Copy link
Owner

ubnt-intrepid commented Feb 22, 2020

#[rye::test]
fn typed_test<T>()
where
    T: fmt::Debug + Default,
{
    let default = T::default();
    assert!( format!("{:?}", default) != "" );
}

rye::typed_test!(test_template::<i32>);
rye::typed_test!(test_template::<String>);
#[cfg(feature = "foo")]
rye::typed_test!(test_template::<(i32, f32)>);

The above test will generate the following test cases:

  • typed_test::<i32>
  • typed_test::<String>
  • typed_test::<(i32, f32)> (with feature = "foo")

ref: https://github.com/catchorg/Catch2/blob/master/docs/test-cases-and-sections.md#type-parametrised-test-cases

@ubnt-intrepid ubnt-intrepid changed the title parametrized test cases type-parametrized test cases Mar 10, 2020
@ubnt-intrepid ubnt-intrepid added this to the Backlog milestone Mar 30, 2020
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