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

Parametric suites #60

Open
silentbicycle opened this issue Aug 12, 2017 · 2 comments
Open

Parametric suites #60

silentbicycle opened this issue Aug 12, 2017 · 2 comments
Milestone

Comments

@silentbicycle
Copy link
Owner

There should be RUN_SUITE1/RUN_SUITEp macros for suites that take argument(s), such as a random number seed, verbosity setting, or iteration limit.

Because the existing syntax for defining/calling suites is SUITE(suitename), this will be a breaking API change.

/* previous style */
SUITE(suite);

/* new style */
SUITE suite(void);
SUITE suite1(void *some_arg);
SUITE suite_multi(size_t apple, void *banana, int carrot);

SUITE suite(void) {}

RUN_SUITE(suite);   /* no change */

RUN_SUITE1(suite1, arg);  /* suite with 1 argument */

/* suite with multiple arguments (C99 and later standards only) */
RUN_SUITEp(suite_multi, 1, NULL, 2);
@silentbicycle silentbicycle added this to the 2.0.0 milestone Aug 12, 2017
@tekknolagi
Copy link
Contributor

tekknolagi commented Sep 3, 2020

Would this pass the argument to a suite? Is it possible to have something like this that passes the arguments to every test? I am thinking of a setup/teardown configuration for every test in a suite.

@silentbicycle
Copy link
Owner Author

It would pass an argument to the suite, which could pass it to any test(s) that need it. You can already pass arguments to tests, and there are already setup/teardown hooks, which once set will be called around all the following tests in the suite.

Functionally, it's not a complicated change, but it will be a breaking change to a long-stable interface, so I want to be very thoughtful of the new interface and wait until a new major release to merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants