Hi René On 07/07/2024 08:20, René Scharfe wrote:
Hmm, again. I can see the appeal. How to call it? Given that the foreach macros have lower-case names, perhaps to indicate that they act as control flow statements, not function-like macro calls, would we want lower case here as well?
I'd automatically assumed we'd want an uppercase name to signal that it was a pre-processor macro but I've not really spent any time thinking about it.
#define test(...) if (TEST_RUN(__VA_ARGS__)) test ("passing test") check(1); test ("split single item") { struct strvec vec = STRVEC_INIT; strvec_split(&vec, "foo"); check_strvec(&vec, "foo", NULL); strvec_clear(&vec); } Can't get much cleaner than that.
Yes, I like it
Requires learning that this macro is not function-like, but it's probably not too much to ask.
For someone new to the project it should hopefully be pretty clear how to use it from the existing tests once we have a few more test files that use it. Maybe an uppercase name would signal that it is special?
Best Wishes Phillip