How to write a unit test for a conditional macro?

I’d advise you to use the same trick as ToggleableAsserts.jl, which I think originates from this discourse thread:

With this technique you explicitly toggle the behavior of your macro by redefining a function, which invalidates all code using the macro and forces a recompilation.

ToggleableAsserts show how easily such macros can be tested:

1 Like